From b72d45d9dbff2c17d299788b14dbd8429bc01258 Mon Sep 17 00:00:00 2001 From: nobohan Date: Mon, 28 Jun 2021 13:50:31 +0200 Subject: [PATCH] accompanying period: hide activity entries from the menu if accompanyin period is DRAFT --- .../Menu/AccompanyingCourseMenuBuilder.php | 13 +++---------- 1 file changed, 3 insertions(+), 10 deletions(-) diff --git a/src/Bundle/ChillActivityBundle/Menu/AccompanyingCourseMenuBuilder.php b/src/Bundle/ChillActivityBundle/Menu/AccompanyingCourseMenuBuilder.php index 71d465b6c..8906e736c 100644 --- a/src/Bundle/ChillActivityBundle/Menu/AccompanyingCourseMenuBuilder.php +++ b/src/Bundle/ChillActivityBundle/Menu/AccompanyingCourseMenuBuilder.php @@ -4,6 +4,7 @@ namespace Chill\ActivityBundle\Menu; use Chill\MainBundle\Routing\LocalMenuBuilderInterface; use Chill\MainBundle\Security\Authorization\AuthorizationHelper; +use Chill\PersonBundle\Entity\AccompanyingPeriod; use Knp\Menu\MenuItem; use Symfony\Component\Security\Core\Authentication\Token\Storage\TokenStorageInterface; use Symfony\Contracts\Translation\TranslatorInterface; @@ -34,21 +35,13 @@ class AccompanyingCourseMenuBuilder implements LocalMenuBuilderInterface { $period = $parameters['accompanyingCourse']; + if (AccompanyingPeriod::STEP_DRAFT !== $period->getStep()) { $menu->addChild($this->translator->trans('Activity list'), [ 'route' => 'chill_activity_activity_list', 'routeParameters' => [ 'accompanying_period_id' => $period->getId(), ]]) ->setExtras(['order' => 40]); - - $menu->addChild($this->translator->trans('Add a new activity'), [ - 'route' => 'chill_activity_activity_select_type', - 'routeParameters' => [ - 'accompanying_period_id' => $period->getId(), - ]]) - ->setExtras(['order' => 41]); - - - + } } }