Edit on GitHub

Loading Assets in the Admin UI

If you need to load assets (JS, CSS) in the Admin or Editmode UI, you have 2 options, depending on if you do that from a Pimcore Bundle or from somewhere else.

Pimcore Bundles

Just implement the methods defined in the PimcoreBundleInterface, e.g. getJsPaths() or getEditmodeCssPaths().

Event Based

You can add additional paths to load by handling the events defined on BundleManagerEvents. For example, to load the JS file when loading the admin UI, implement an event listener like the following (please see Events for details on how to implement and register event listeners):


namespace AppBundle\EventListener;

use Pimcore\Event\BundleManager\PathsEvent;
use Pimcore\Event\BundleManagerEvents;
use Symfony\Component\EventDispatcher\EventSubscriberInterface;

class AdminAssetsListener implements EventSubscriberInterface
    public static function getSubscribedEvents()
        return [
            BundleManagerEvents::JS_PATHS => 'onJsPaths'

    public function onJsPaths(PathsEvent $event)
        $event->setPaths(array_merge($event->getPaths(), [