vendor/pimcore/portal-engine/src/EventSubscriber/AdminSettingsSubscriber.php line 43

Open in your IDE?
  1. <?php
  2. /**
  3.  * Pimcore
  4.  *
  5.  * This source file is available under following license:
  6.  * - Pimcore Commercial License (PCL)
  7.  *
  8.  *  @copyright  Copyright (c) Pimcore GmbH (http://www.pimcore.org)
  9.  *  @license    http://www.pimcore.org/license     PCL
  10.  */
  11. namespace Pimcore\Bundle\PortalEngineBundle\EventSubscriber;
  12. use Pimcore\Event\Admin\IndexActionSettingsEvent;
  13. use Pimcore\Event\AdminEvents;
  14. use Symfony\Component\EventDispatcher\EventSubscriberInterface;
  15. class AdminSettingsSubscriber implements EventSubscriberInterface
  16. {
  17.     /**
  18.      * @var array
  19.      */
  20.     protected $possiblePortalDomains = [];
  21.     public function __construct(array $possiblePortalDomains)
  22.     {
  23.         $explodedDomains = [];
  24.         foreach ($possiblePortalDomains as $domain) {
  25.             $explodedDomains array_merge($explodedDomainsexplode(','$domain));
  26.         }
  27.         $this->possiblePortalDomains $explodedDomains;
  28.     }
  29.     public static function getSubscribedEvents()
  30.     {
  31.         return [
  32.             AdminEvents::INDEX_ACTION_SETTINGS => 'getSettings',
  33.         ];
  34.     }
  35.     public function getSettings(IndexActionSettingsEvent $event)
  36.     {
  37.         if (!empty($this->possiblePortalDomains)) {
  38.             $event->addSetting('portalEngine', ['possiblePortalDomains' => $this->possiblePortalDomains]);
  39.         }
  40.     }
  41. }