mirror of
https://gitlab.com/Chill-Projet/chill-bundles.git
synced 2025-06-07 18:44:08 +00:00
Menu entry added household menu
This commit is contained in:
parent
8f6ab15621
commit
9065ec40b1
53
src/Bundle/ChillBudgetBundle/Menu/HouseholdMenuBuilder.php
Normal file
53
src/Bundle/ChillBudgetBundle/Menu/HouseholdMenuBuilder.php
Normal file
@ -0,0 +1,53 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* Chill is a software for social workers
|
||||
*
|
||||
* For the full copyright and license information, please view
|
||||
* the LICENSE file that was distributed with this source code.
|
||||
*/
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace Chill\BudgetBundle\Menu;
|
||||
|
||||
use Chill\BudgetBundle\Security\Authorization\BudgetElementVoter;
|
||||
use Chill\MainBundle\Routing\LocalMenuBuilderInterface;
|
||||
use Knp\Menu\MenuItem;
|
||||
use Symfony\Component\Security\Core\Authorization\AuthorizationCheckerInterface;
|
||||
use Symfony\Contracts\Translation\TranslatorInterface;
|
||||
|
||||
class HouseholdMenuBuilder implements LocalMenuBuilderInterface
|
||||
{
|
||||
protected AuthorizationCheckerInterface $authorizationChecker;
|
||||
|
||||
protected TranslatorInterface $translator;
|
||||
|
||||
public function __construct(
|
||||
AuthorizationCheckerInterface $authorizationChecker,
|
||||
TranslatorInterface $translator
|
||||
) {
|
||||
$this->authorizationChecker = $authorizationChecker;
|
||||
$this->translator = $translator;
|
||||
}
|
||||
|
||||
public function buildMenu($menuId, MenuItem $menu, array $parameters)
|
||||
{
|
||||
/** @var Household $household */
|
||||
$household = $parameters['household'];
|
||||
|
||||
// if ($this->authorizationChecker->isGranted(BudgetElementVoter::SHOW, $household)) {
|
||||
$menu->addChild($this->translator->trans('household.Budget'), [
|
||||
'route' => 'chill_budget_elements_household_index',
|
||||
'routeParameters' => [
|
||||
'id' => $household->getId(),
|
||||
], ])
|
||||
->setExtras(['order' => 50]);
|
||||
// }
|
||||
}
|
||||
|
||||
public static function getMenuIds(): array
|
||||
{
|
||||
return ['household'];
|
||||
}
|
||||
}
|
@ -3,3 +3,7 @@ services:
|
||||
autowire: true
|
||||
tags:
|
||||
- { name: 'chill.menu_builder' }
|
||||
Chill\BudgetBundle\Menu\HouseholdMenuBuilder:
|
||||
autowire: true
|
||||
tags:
|
||||
- { name: 'chill.menu_builder' }
|
||||
|
@ -66,13 +66,6 @@ class HouseholdMenuBuilder implements LocalMenuBuilderInterface
|
||||
'household_id' => $household->getId(),
|
||||
], ])
|
||||
->setExtras(['order' => 30]);
|
||||
|
||||
$menu->addChild($this->translator->trans('household.Budget'), [
|
||||
'route' => 'chill_person_household_budget_index',
|
||||
'routeParameters' => [
|
||||
'household_id' => $household->getId(),
|
||||
], ])
|
||||
->setExtras(['order' => 30]);
|
||||
}
|
||||
|
||||
public static function getMenuIds(): array
|
||||
|
Loading…
x
Reference in New Issue
Block a user