src/EventListener/PimcoreAdminListener.php line 22

Open in your IDE?
  1. <?php
  2. /**
  3.  * Pimcore
  4.  *
  5.  * This source file is available under two different licenses:
  6.  * - GNU General Public License version 3 (GPLv3)
  7.  * - Pimcore Enterprise License (PEL)
  8.  * Full copyright and license information is available in
  9.  * LICENSE.md which is distributed with this source code.
  10.  *
  11.  *  @copyright  Copyright (c) Pimcore GmbH (http://www.pimcore.org)
  12.  *  @license    http://www.pimcore.org/license     GPLv3 and PEL
  13.  */
  14. namespace App\EventListener;
  15. use Pimcore\Event\BundleManager\PathsEvent;
  16. class PimcoreAdminListener
  17. {
  18.     public function addCSSFiles(PathsEvent $event)
  19.     {
  20.         $event->setPaths(
  21.             array_merge(
  22.                 $event->getPaths(),
  23.                 [
  24.                     '/static/css/admin-style.css'
  25.                 ]
  26.             )
  27.         );
  28.     }
  29.     public function addJSFiles(PathsEvent $event)
  30.     {
  31.         $event->setPaths(
  32.             array_merge(
  33.                 $event->getPaths(),
  34.                 [
  35.                     '/static/js/startup.js'
  36.                 ]
  37.             )
  38.         );
  39.     }
  40.     public function onResolveElementAdminStyle(\Pimcore\Event\Admin\ElementAdminStyleEvent $event)
  41.     {
  42.         $element $event->getElement();
  43.         // decide which default styles you want to override
  44.         if ($element instanceof \App\Model\Product\Car) {
  45.             $event->setAdminStyle(new \App\Model\Product\AdminStyle\Car($element));
  46.         }
  47.     }
  48. }