Created
November 13, 2019 08:26
-
-
Save brusch/73b3afda260550718298630579dc2d06 to your computer and use it in GitHub Desktop.
Add jQuery to Pimcore admin interface
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
namespace AppBundle\EventListener; | |
use Pimcore\Event\BundleManager\PathsEvent; | |
use Pimcore\Event\BundleManagerEvents; | |
use Symfony\Component\EventDispatcher\EventSubscriberInterface; | |
class JqueryAdminListener implements EventSubscriberInterface | |
{ | |
public static function getSubscribedEvents() | |
{ | |
return [ | |
BundleManagerEvents::JS_PATHS => 'addJSFiles' | |
]; | |
} | |
public function addJSFiles(PathsEvent $event) | |
{ | |
$event->setPaths( | |
array_merge( | |
$event->getPaths(), | |
[ | |
'https://ajax.googleapis.com/ajax/libs/jquery/3.4.1/jquery.min.js' | |
] | |
) | |
); | |
} | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
services: | |
AppBundle\EventListener\JqueryAdminListener: ~ |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment