vendor/ibexa/site-context/src/bundle/EventSubscriber/FocusModeSubscriber.php line 31

Open in your IDE?
  1. <?php
  2. /**
  3. * @copyright Copyright (C) Ibexa AS. All rights reserved.
  4. * @license For full copyright and license information view LICENSE file distributed with this source code.
  5. */
  6. declare(strict_types=1);
  7. namespace Ibexa\Bundle\SiteContext\EventSubscriber;
  8. use Ibexa\Contracts\AdminUi\Event\FocusModeChangedEvent;
  9. use Ibexa\Contracts\SiteContext\SiteContextServiceInterface;
  10. use Symfony\Component\EventDispatcher\EventSubscriberInterface;
  11. final class FocusModeSubscriber implements EventSubscriberInterface
  12. {
  13. private SiteContextServiceInterface $siteContextService;
  14. public function __construct(SiteContextServiceInterface $siteContextService)
  15. {
  16. $this->siteContextService = $siteContextService;
  17. }
  18. public static function getSubscribedEvents(): array
  19. {
  20. return [
  21. FocusModeChangedEvent::class => 'onFocusModeChanged',
  22. ];
  23. }
  24. public function onFocusModeChanged(FocusModeChangedEvent $event): void
  25. {
  26. if ($event->isEnabled()) {
  27. $this->siteContextService->setFullscreenMode(true);
  28. }
  29. }
  30. }