vendor/ibexa/system-info/src/lib/EventListener/SystemInfoTabGroupListener.php line 55

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. namespace Ibexa\SystemInfo\EventListener;
  7. use Ibexa\AdminUi\Tab\Event\TabEvents;
  8. use Ibexa\AdminUi\Tab\Event\TabGroupEvent;
  9. use Ibexa\AdminUi\Tab\TabRegistry;
  10. use Ibexa\Bundle\SystemInfo\SystemInfo\SystemInfoCollectorRegistry;
  11. use Ibexa\SystemInfo\Tab\SystemInfo\TabFactory;
  12. use Symfony\Component\EventDispatcher\EventSubscriberInterface;
  13. class SystemInfoTabGroupListener implements EventSubscriberInterface
  14. {
  15.     /** @var \Ibexa\AdminUi\Tab\TabRegistry */
  16.     protected $tabRegistry;
  17.     /** @var \Ibexa\SystemInfo\Tab\SystemInfo\TabFactory */
  18.     protected $tabFactory;
  19.     /** @var \Ibexa\Bundle\SystemInfo\SystemInfo\SystemInfoCollectorRegistry */
  20.     protected $systeminfoCollectorRegistry;
  21.     /**
  22.      * @param \Ibexa\AdminUi\Tab\TabRegistry $tabRegistry
  23.      * @param \Ibexa\SystemInfo\Tab\SystemInfo\TabFactory $tabFactory
  24.      * @param \Ibexa\Bundle\SystemInfo\SystemInfo\SystemInfoCollectorRegistry $systeminfoCollectorRegistry
  25.      */
  26.     public function __construct(
  27.         TabRegistry $tabRegistry,
  28.         TabFactory $tabFactory,
  29.         SystemInfoCollectorRegistry $systeminfoCollectorRegistry
  30.     ) {
  31.         $this->tabRegistry $tabRegistry;
  32.         $this->tabFactory $tabFactory;
  33.         $this->systeminfoCollectorRegistry $systeminfoCollectorRegistry;
  34.     }
  35.     /**
  36.      * @return array
  37.      */
  38.     public static function getSubscribedEvents(): array
  39.     {
  40.         return [
  41.             TabEvents::TAB_GROUP_PRE_RENDER => ['onTabGroupPreRender'10],
  42.         ];
  43.     }
  44.     /**
  45.      * @param \Ibexa\AdminUi\Tab\Event\TabGroupEvent $event
  46.      */
  47.     public function onTabGroupPreRender(TabGroupEvent $event)
  48.     {
  49.         $tabGroup $event->getData();
  50.         if ('systeminfo' !== $tabGroup->getIdentifier()) {
  51.             return;
  52.         }
  53.         foreach ($this->systeminfoCollectorRegistry->getIdentifiers() as $collectorIdentifier) {
  54.             $tabGroup->addTab($this->tabFactory->createTab($collectorIdentifier));
  55.         }
  56.     }
  57. }
  58. class_alias(SystemInfoTabGroupListener::class, 'EzSystems\EzSupportTools\EventListener\SystemInfoTabGroupListener');