vendor/bluue/crm-bundle/src/EventSubscriber/DashboardSubscriber.php line 43

Open in your IDE?
  1. <?php
  2. /**
  3.  * @author Thomas HERISSON (contact@scaledev.fr)
  4.  * @copyright 2021 - ScaleDEV SAS, 12 RUE CHARLES MORET, 10120 ST ANDRE LES VERGERS
  5.  * @license commercial
  6.  */
  7. declare(strict_types=1);
  8. namespace Bluue\CrmBundle\EventSubscriber;
  9. use App\Event\DashboardWidgetsEvent;
  10. use Bluue\CustomersBundle\Event\CustomerDashboardWidgetsEvent;
  11. use Symfony\Component\EventDispatcher\EventSubscriberInterface;
  12. class DashboardSubscriber implements EventSubscriberInterface
  13. {
  14.     /**
  15.      * @return string[]
  16.      */
  17.     public static function getSubscribedEvents(): array
  18.     {
  19.         return [
  20.             DashboardWidgetsEvent::NAME => 'onLoad',
  21.             CustomerDashboardWidgetsEvent::NAME => 'customerDashboard'
  22.         ];
  23.     }
  24.     /**
  25.      * @param DashboardWidgetsEvent $event
  26.      * @return void
  27.      */
  28.     public function onLoad(DashboardWidgetsEvent $event): void
  29.     {
  30.         $event->addWidget('crm_bundle__dashboard_opportunities');
  31.     }
  32.     /**
  33.      * @param CustomerDashboardWidgetsEvent $event
  34.      * @return void
  35.      */
  36.     public function customerDashboard(CustomerDashboardWidgetsEvent $event): void
  37.     {
  38.         $event->addWidget('crm_bundle__dashboard_opportunities');
  39.     }
  40. }