mirror of
https://gitlab.com/Chill-Projet/chill-bundles.git
synced 2025-06-12 13:24:25 +00:00
sf4, fix section menu translations and add missing translations
This commit is contained in:
parent
8d4d8f3a0d
commit
5245d9971e
@ -1,4 +1,5 @@
|
|||||||
<?php
|
<?php
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Copyright (C) 2018 Champs-Libres <info@champs-libres.coop>
|
* Copyright (C) 2018 Champs-Libres <info@champs-libres.coop>
|
||||||
*
|
*
|
||||||
@ -15,36 +16,54 @@
|
|||||||
* You should have received a copy of the GNU Affero General Public License
|
* You should have received a copy of the GNU Affero General Public License
|
||||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
namespace Chill\PersonBundle\Menu;
|
namespace Chill\PersonBundle\Menu;
|
||||||
|
|
||||||
use Chill\MainBundle\Routing\LocalMenuBuilderInterface;
|
use Chill\MainBundle\Routing\LocalMenuBuilderInterface;
|
||||||
use Knp\Menu\MenuItem;
|
use Knp\Menu\MenuItem;
|
||||||
use Symfony\Component\Security\Core\Authorization\AuthorizationCheckerInterface;
|
use Symfony\Component\Security\Core\Authorization\AuthorizationCheckerInterface;
|
||||||
use Chill\PersonBundle\Security\Authorization\PersonVoter;
|
use Chill\PersonBundle\Security\Authorization\PersonVoter;
|
||||||
|
use Symfony\Component\Translation\TranslatorInterface;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
* Class SectionMenuBuilder
|
||||||
*
|
*
|
||||||
*
|
* @package Chill\PersonBundle\Menu
|
||||||
* @author Julien Fastré <julien.fastre@champs-libres.coop>
|
* @author Julien Fastré <julien.fastre@champs-libres.coop>
|
||||||
*/
|
*/
|
||||||
class SectionMenuBuilder implements LocalMenuBuilderInterface
|
class SectionMenuBuilder implements LocalMenuBuilderInterface
|
||||||
{
|
{
|
||||||
/**
|
/**
|
||||||
*
|
|
||||||
* @var AuthorizationCheckerInterface
|
* @var AuthorizationCheckerInterface
|
||||||
*/
|
*/
|
||||||
protected $authorizationChecker;
|
protected $authorizationChecker;
|
||||||
|
|
||||||
public function __construct(AuthorizationCheckerInterface $authorizationChecker)
|
/**
|
||||||
|
* @var TranslatorInterface
|
||||||
|
*/
|
||||||
|
protected $translator;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* SectionMenuBuilder constructor.
|
||||||
|
*
|
||||||
|
* @param AuthorizationCheckerInterface $authorizationChecker
|
||||||
|
* @param TranslatorInterface $translator
|
||||||
|
*/
|
||||||
|
public function __construct(AuthorizationCheckerInterface $authorizationChecker, TranslatorInterface $translator)
|
||||||
{
|
{
|
||||||
$this->authorizationChecker = $authorizationChecker;
|
$this->authorizationChecker = $authorizationChecker;
|
||||||
|
$this->translator = $translator;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param $menuId
|
||||||
|
* @param MenuItem $menu
|
||||||
|
* @param array $parameters
|
||||||
|
*/
|
||||||
public function buildMenu($menuId, MenuItem $menu, array $parameters)
|
public function buildMenu($menuId, MenuItem $menu, array $parameters)
|
||||||
{
|
{
|
||||||
if ($this->authorizationChecker->isGranted(PersonVoter::CREATE)) {
|
if ($this->authorizationChecker->isGranted(PersonVoter::CREATE)) {
|
||||||
$menu->addChild('Add a person', [
|
$menu->addChild($this->translator->trans('Add a person'), [
|
||||||
'route' => 'chill_person_new'
|
'route' => 'chill_person_new'
|
||||||
])
|
])
|
||||||
->setExtras([
|
->setExtras([
|
||||||
@ -54,6 +73,9 @@ class SectionMenuBuilder implements LocalMenuBuilderInterface
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @return array
|
||||||
|
*/
|
||||||
public static function getMenuIds(): array
|
public static function getMenuIds(): array
|
||||||
{
|
{
|
||||||
return [ 'section' ];
|
return [ 'section' ];
|
||||||
|
@ -2,6 +2,7 @@ services:
|
|||||||
Chill\PersonBundle\Menu\SectionMenuBuilder:
|
Chill\PersonBundle\Menu\SectionMenuBuilder:
|
||||||
arguments:
|
arguments:
|
||||||
$authorizationChecker: '@Symfony\Component\Security\Core\Authorization\AuthorizationCheckerInterface'
|
$authorizationChecker: '@Symfony\Component\Security\Core\Authorization\AuthorizationCheckerInterface'
|
||||||
|
$translator: '@Symfony\Component\Translation\TranslatorInterface'
|
||||||
tags:
|
tags:
|
||||||
- { name: 'chill.menu_builder' }
|
- { name: 'chill.menu_builder' }
|
||||||
|
|
||||||
|
@ -152,6 +152,7 @@ Back to the person details: Retour aux détails de la personne
|
|||||||
Timeline: Historique
|
Timeline: Historique
|
||||||
Closing the accompanying period: Fermeture de la période d'accompagnement
|
Closing the accompanying period: Fermeture de la période d'accompagnement
|
||||||
Opening the accompanying period: Ouverture d'une période d'accompagnement
|
Opening the accompanying period: Ouverture d'une période d'accompagnement
|
||||||
|
'Timeline for %name%': 'Historique de %name%'
|
||||||
|
|
||||||
#roles
|
#roles
|
||||||
CHILL_PERSON_SEE: Voir les personnes
|
CHILL_PERSON_SEE: Voir les personnes
|
||||||
|
Loading…
x
Reference in New Issue
Block a user