vendor/ibexa/admin-ui/src/lib/UniversalDiscovery/Event/Subscriber/UserSelectionAllowedContentTypes.php line 38

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\AdminUi\UniversalDiscovery\Event\Subscriber;
  8. use Ibexa\AdminUi\UniversalDiscovery\Event\ConfigResolveEvent;
  9. use Ibexa\Contracts\Core\SiteAccess\ConfigResolverInterface;
  10. use Symfony\Component\EventDispatcher\EventSubscriberInterface;
  11. class UserSelectionAllowedContentTypes implements EventSubscriberInterface
  12. {
  13.     /** @var \Ibexa\Contracts\Core\SiteAccess\ConfigResolverInterface */
  14.     protected $configResolver;
  15.     public function __construct(ConfigResolverInterface $configResolver)
  16.     {
  17.         $this->configResolver $configResolver;
  18.     }
  19.     /**
  20.      * @return array
  21.      */
  22.     public static function getSubscribedEvents(): array
  23.     {
  24.         return [
  25.             ConfigResolveEvent::NAME => ['onUdwConfigResolve'],
  26.         ];
  27.     }
  28.     /**
  29.      * @param \Ibexa\AdminUi\UniversalDiscovery\Event\ConfigResolveEvent $event
  30.      */
  31.     public function onUdwConfigResolve(ConfigResolveEvent $event): void
  32.     {
  33.         $config $event->getConfig();
  34.         if (!in_array($event->getConfigName(), ['single_user''multiple_user'])) {
  35.             return;
  36.         }
  37.         $config['allowed_content_types'] = $this->configResolver->getParameter('user_content_type_identifier');
  38.         $event->setConfig($config);
  39.     }
  40. }
  41. class_alias(UserSelectionAllowedContentTypes::class, 'EzSystems\EzPlatformAdminUi\UniversalDiscovery\Event\Subscriber\UserSelectionAllowedContentTypes');