src/Admin/EventSubscriber/AdminStyleSubscriber.php line 23

Open in your IDE?
  1. <?php
  2. namespace App\Admin\EventSubscriber;
  3. use App\Admin\AdminStyle\ProfileAdminStyle;
  4. use App\Profile\Model\Profile;
  5. use Pimcore\Event\Admin\ElementAdminStyleEvent;
  6. use Pimcore\Event\AdminEvents;
  7. use Symfony\Component\EventDispatcher\EventSubscriberInterface;
  8. /**
  9.  * @codeCoverageIgnore
  10.  */
  11. class AdminStyleSubscriber implements EventSubscriberInterface
  12. {
  13.   public static function getSubscribedEvents()
  14.   {
  15.     return [
  16.       AdminEvents::RESOLVE_ELEMENT_ADMIN_STYLE => 'resolveElementAdminStyle',
  17.     ];
  18.   }
  19.   public function resolveElementAdminStyle(ElementAdminStyleEvent $event)
  20.   {
  21.     $element $event->getElement();
  22.     if ($element instanceof Profile) {
  23.       $event->setAdminStyle(new ProfileAdminStyle($element));
  24.     }
  25.   }
  26. }