<?php
/*
* @since 1.0.0
* @copyright Copyright (C) 2020 ArtMedia. All rights reserved.
* @website http://artmedia.biz.pl
* @author Arkadiusz Tobiasz
* @email kontakt@artmedia.biz.pl
*/
namespace App\EventSubscriber\Core;
use Symfony\Component\EventDispatcher\EventSubscriberInterface;
use App\Events\Core\RouteAddEvent;
use Symfony\Contracts\Translation\TranslatorInterface;
class LayoutSubscriber implements EventSubscriberInterface
{
private $translator;
public function __construct(
TranslatorInterface $translator
) {
$this->translator = $translator;
}
public static function getSubscribedEvents(): array
{
return [
RouteAddEvent::NAME => 'onRouteAddEvent',
];
}
public function onRouteAddEvent(RouteAddEvent $event): void
{
$routes = [
'login' => $this->translator->trans('Login Page', [], 'admin'),
'app_register' => $this->translator->trans('Register Page', [], 'admin'),
'app_forgot_password_request' => $this->translator->trans('Forgot password Page', [], 'admin'),
'user_edit' => $this->translator->trans('Edit user account Page', [], 'admin'),
'user_change_password' => $this->translator->trans('Change password Page', [], 'admin'),
'contact' => $this->translator->trans('Contact Page', [], 'admin'),
'app_logout' => $this->translator->trans('Logout Page', [], 'admin'),
'user_preferences' => $this->translator->trans('User Preferences Page', [], 'admin'),
'profile_index' => $this->translator->trans('My Profiles Page', [], 'admin'),
'report_bug' => $this->translator->trans('Report Bug Page', [], 'admin'),
'transaction_topup' => $this->translator->trans('Top up Balance Page', [], 'admin'),
'travels_add' => $this->translator->trans('Add travel notice', [], 'admin'),
'user_notifications' => $this->translator->trans('Email notification preferences', [], 'admin'),
];
foreach ($routes as $route => $label) {
$event->addRoute($route, $label);
}
}
}