<?php
/**
* @author Thomas HERISSON (contact@scaledev.fr)
* @copyright 2021 - ScaleDEV SAS, 12 RUE CHARLES MORET, 10120 ST ANDRE LES VERGERS
* @license commercial
*/
declare(strict_types=1);
namespace Bluue\PlanningBundle\EventSubscriber;
use App\Event\EditUserPathsEvent;
use Symfony\Contracts\Translation\TranslatorInterface;
use Symfony\Component\EventDispatcher\EventSubscriberInterface;
class EditUserPathsSubscriber implements EventSubscriberInterface
{
/**
* @var TranslatorInterface
*/
private TranslatorInterface $tr;
/**
* @param TranslatorInterface $tr
*/
public function __construct(
TranslatorInterface $tr
) {
$this->tr = $tr;
}
/**
* @return string[]
*/
public static function getSubscribedEvents(): array
{
return [
EditUserPathsEvent::NAME => 'onLoad'
];
}
/**
* @param EditUserPathsEvent $event
* @return void
*/
public function onLoad(EditUserPathsEvent $event): void
{
$event->addPath([
'url' => 'planning_bundle__google_access',
'id' => $event->getUserId(),
'name' => $this->tr->trans('Google Calendar configuration', [], 'PlanningBundle')
]);
}
}