From e51b35fbc1ccaa21871c50ab7bdeb4537ce19063 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Dawid=20Parafi=C5=84ski?= Date: Fri, 2 Oct 2020 15:47:04 +0200 Subject: [PATCH 1/2] EZP-31983: Catched exception thrown by empty tab group --- .../Event/Subscriber/ConditionalTabSubscriber.php | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/src/lib/Tab/Event/Subscriber/ConditionalTabSubscriber.php b/src/lib/Tab/Event/Subscriber/ConditionalTabSubscriber.php index 632dc8bd9c..ba25a33fe4 100644 --- a/src/lib/Tab/Event/Subscriber/ConditionalTabSubscriber.php +++ b/src/lib/Tab/Event/Subscriber/ConditionalTabSubscriber.php @@ -11,15 +11,13 @@ use EzSystems\EzPlatformAdminUi\Tab\ConditionalTabInterface; use EzSystems\EzPlatformAdminUi\Tab\Event\TabEvents; use EzSystems\EzPlatformAdminUi\Tab\Event\TabGroupEvent; -use EzSystems\EzPlatformAdminUi\Tab\OrderedTabInterface; use EzSystems\EzPlatformAdminUi\UI\Service\TabService; use Symfony\Component\EventDispatcher\EventSubscriberInterface; /** - * Reorders tabs according to their Order value (Tabs implementing OrderedTabInterface). - * Tabs without order specified are pushed to the end of the group. + * Evaluates if tabs should be visible (Tabs implementing ConditionalTabInterface). * - * @see OrderedTabInterface + * @see ConditionalTabInterface */ class ConditionalTabSubscriber implements EventSubscriberInterface { @@ -51,7 +49,11 @@ public function onTabGroupInitialize(TabGroupEvent $tabGroupEvent) $tabGroup = $tabGroupEvent->getData(); $tabGroupIdentifier = $tabGroupEvent->getData()->getIdentifier(); $parameters = $tabGroupEvent->getParameters(); - $tabs = $this->tabService->getTabGroup($tabGroupIdentifier)->getTabs(); + try { + $tabs = $this->tabService->getTabGroup($tabGroupIdentifier)->getTabs(); + } catch (\InvalidArgumentException $invalidArgumentException) { + $tabs = []; + } foreach ($tabs as $tab) { if (!$tab instanceof ConditionalTabInterface || $tab->evaluate($parameters)) { From a6677ea8d1efe79cb4f49813ac280fb96304a3b3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Dawid=20Parafi=C5=84ski?= Date: Mon, 5 Oct 2020 09:29:11 +0200 Subject: [PATCH 2/2] EZEE-3281: Imported exception class --- src/lib/Tab/Event/Subscriber/ConditionalTabSubscriber.php | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/lib/Tab/Event/Subscriber/ConditionalTabSubscriber.php b/src/lib/Tab/Event/Subscriber/ConditionalTabSubscriber.php index ba25a33fe4..1ad0d8b73d 100644 --- a/src/lib/Tab/Event/Subscriber/ConditionalTabSubscriber.php +++ b/src/lib/Tab/Event/Subscriber/ConditionalTabSubscriber.php @@ -12,6 +12,7 @@ use EzSystems\EzPlatformAdminUi\Tab\Event\TabEvents; use EzSystems\EzPlatformAdminUi\Tab\Event\TabGroupEvent; use EzSystems\EzPlatformAdminUi\UI\Service\TabService; +use InvalidArgumentException; use Symfony\Component\EventDispatcher\EventSubscriberInterface; /** @@ -51,7 +52,7 @@ public function onTabGroupInitialize(TabGroupEvent $tabGroupEvent) $parameters = $tabGroupEvent->getParameters(); try { $tabs = $this->tabService->getTabGroup($tabGroupIdentifier)->getTabs(); - } catch (\InvalidArgumentException $invalidArgumentException) { + } catch (InvalidArgumentException $e) { $tabs = []; }