<?php
/**
* @author Léo BANNHOLTZER (contact@scaledev.fr)
* @copyright 2021 - ScaleDEV SAS, 12 RUE CHARLES MORET, 10120 ST ANDRE LES VERGERS
* @license commercial
*/
declare(strict_types=1);
namespace Bluue\StocksBundle\EventSubscriber;
use App\Event\AdditionalJavascriptsEvent;
use Symfony\Component\EventDispatcher\EventSubscriberInterface;
class AdditionalJavascriptsSubscriber implements EventSubscriberInterface
{
/**
* @return string[]
*/
public static function getSubscribedEvents(): array
{
return [
AdditionalJavascriptsEvent::NAME => 'onLoad'
];
}
/**
* @param AdditionalJavascriptsEvent $event
* @return void
*/
public function onLoad(AdditionalJavascriptsEvent $event): void
{
$javascripts = [
[
'entry' => 'stocks_bundle',
'controllers' => [
[
'name' => 'stocks--delivery-note',
'routes' => [
'sales_bundle__order_edit',
'sales_bundle__order_view'
]
],
[
'name' => 'stocks--product-sheet',
'routes' => [
'products_bundle__product_sheet'
]
]
]
]
];
$event->addJavascripts($javascripts);
}
}