<?php
declare(strict_types=1);
namespace Bluue\UtilityBillsBundle\EventSubscriber;
use Bluue\SuppliersOrdersBundle\Event\SupplierOrderTabsEvent;
use Symfony\Component\EventDispatcher\EventSubscriberInterface;
use Symfony\Contracts\Translation\TranslatorInterface;
class SupplierOrderTabsSubscriber implements EventSubscriberInterface
{
/**
* @var TranslatorInterface
*/
private TranslatorInterface $tr;
/**
* @param TranslatorInterface $tr
*/
public function __construct(TranslatorInterface $tr)
{
$this->tr = $tr;
}
/**
* @return array|string[]
*/
public static function getSubscribedEvents(): array
{
return [
SupplierOrderTabsEvent::TABS => 'onLoad'
];
}
public function onLoad(SupplierOrderTabsEvent $event): void
{
$invoiceTab = [
'key' => 'invoice',
'icon' => 'fa fa-file-alt mr-1',
'name' => $this->tr->trans('Invoices', [], 'UtilityBillsBundle'),
'path' => 'utility_bills_bundle__utility_bill_order_list'
];
$event->addTab($invoiceTab);
}
}