registerDashboardWidget(CalendarWidget::class); // TODO: drop conditional code when the app is 23+ if (method_exists($context, 'registerProfileLinkAction')) { $context->registerProfileLinkAction(AppointmentsAction::class); } $context->registerReferenceProvider(ReferenceProvider::class); $context->registerEventListener(BeforeAppointmentBookedEvent::class, AppointmentBookedListener::class); $context->registerEventListener(UserDeletedEvent::class, UserDeletedListener::class); $context->registerEventListener(RenderReferenceEvent::class, CalendarReferenceListener::class); $context->registerNotifierService(Notifier::class); } /** * @inheritDoc */ #[\Override] public function boot(IBootContext $context): void { $this->addContactsMenuScript($context->getServerContainer()); } private function addContactsMenuScript(ContainerInterface $container): void { // ServerVersion was added in 31, but we don't care about older versions anyway try { /** @var ServerVersion $serverVersion */ $serverVersion = $container->get(ServerVersion::class); } catch (ContainerExceptionInterface $e) { return; } // TODO: drop condition once we only support F7cloud >= 31 if ($serverVersion->getMajorVersion() >= 31) { // The contacts menu/avatar is potentially shown everywhere so an event based loading // mechanism doesn't make sense here - well, maybe not when not logged in yet :-) $userSession = $container->get(IUserSession::class); if (!$userSession->isLoggedIn()) { return; } Util::addScript(self::APP_ID, 'calendar-contacts-menu'); } } }