From f11c6f4c403165ed3250b8f931ea04e4646b5b95 Mon Sep 17 00:00:00 2001 From: Markus Bachmann Date: Wed, 1 Mar 2023 14:48:29 +0100 Subject: [PATCH 1/2] Add testcase for nested extra keys The RouteVoter want multiple values in order to mark an item as active. --- .../Fixtures/Bundle2/Resources/config/navigation.yml | 3 +++ Tests/Provider/ConfigurationMenuProviderTest.php | 2 ++ 2 files changed, 5 insertions(+) diff --git a/Tests/DependencyInjection/Fixtures/Bundle2/Resources/config/navigation.yml b/Tests/DependencyInjection/Fixtures/Bundle2/Resources/config/navigation.yml index 2a6a68d..5ba1850 100644 --- a/Tests/DependencyInjection/Fixtures/Bundle2/Resources/config/navigation.yml +++ b/Tests/DependencyInjection/Fixtures/Bundle2/Resources/config/navigation.yml @@ -27,6 +27,9 @@ main: extras: key1: value1 key2: value2 + routes: + - pattern: /^foo/ + - pattern: /^bar/ four_item: label: "Four Item Label" order: 40 diff --git a/Tests/Provider/ConfigurationMenuProviderTest.php b/Tests/Provider/ConfigurationMenuProviderTest.php index 4601f36..54c22d0 100644 --- a/Tests/Provider/ConfigurationMenuProviderTest.php +++ b/Tests/Provider/ConfigurationMenuProviderTest.php @@ -121,6 +121,8 @@ public function testGet(): void 'key1' => 'value1', 'key2' => 'value2', 'routes' => array( + array('pattern' => '/^foo/'), + array('pattern' => '/^bar/'), array('route' => 'my_route', 'parameters' => array('test' => 'test1')) ) ), From fbd5959951f493ab3b3d7b642d6620cf15f6cb22 Mon Sep 17 00:00:00 2001 From: Markus Bachmann Date: Wed, 1 Mar 2023 14:51:22 +0100 Subject: [PATCH 2/2] Allow nested extra keys --- Config/Definition/Builder/MenuNodeDefinition.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Config/Definition/Builder/MenuNodeDefinition.php b/Config/Definition/Builder/MenuNodeDefinition.php index 7949962..2659fda 100644 --- a/Config/Definition/Builder/MenuNodeDefinition.php +++ b/Config/Definition/Builder/MenuNodeDefinition.php @@ -64,7 +64,7 @@ public function menuNodeHierarchy(int $depth = 10): NodeParentInterface ->end() ->end() ->arrayNode('extras') - ->prototype('scalar') + ->prototype('variable') ->end() ->end() ->menuNode('children')->menuNodeHierarchy($depth - 1)