vendor/bluue/utility-bills-bundle/src/EventSubscriber/SupplierOrderTabsSubscriber.php line 36

Open in your IDE?
  1. <?php
  2. declare(strict_types=1);
  3. namespace Bluue\UtilityBillsBundle\EventSubscriber;
  4. use Bluue\SuppliersOrdersBundle\Event\SupplierOrderTabsEvent;
  5. use Symfony\Component\EventDispatcher\EventSubscriberInterface;
  6. use Symfony\Contracts\Translation\TranslatorInterface;
  7. class SupplierOrderTabsSubscriber implements EventSubscriberInterface
  8. {
  9.     /**
  10.      * @var TranslatorInterface
  11.      */
  12.     private TranslatorInterface $tr;
  13.     /**
  14.      * @param TranslatorInterface $tr
  15.      */
  16.     public function __construct(TranslatorInterface $tr)
  17.     {
  18.         $this->tr $tr;
  19.     }
  20.     /**
  21.      * @return array|string[]
  22.      */
  23.     public static function getSubscribedEvents(): array
  24.     {
  25.         return [
  26.             SupplierOrderTabsEvent::TABS => 'onLoad'
  27.         ];
  28.     }
  29.     public function onLoad(SupplierOrderTabsEvent $event): void
  30.     {
  31.         $invoiceTab = [
  32.             'key' => 'invoice',
  33.             'icon' => 'fa fa-file-alt mr-1',
  34.             'name' => $this->tr->trans('Invoices', [], 'UtilityBillsBundle'),
  35.             'path' => 'utility_bills_bundle__utility_bill_order_list'
  36.         ];
  37.         $event->addTab($invoiceTab);
  38.     }
  39. }