diff --git a/modules/thunder_gqls/graphql/thunder_menu.base.graphqls b/modules/thunder_gqls/graphql/thunder_menu.base.graphqls index eadd9339d..7e233832b 100644 --- a/modules/thunder_gqls/graphql/thunder_menu.base.graphqls +++ b/modules/thunder_gqls/graphql/thunder_menu.base.graphqls @@ -6,7 +6,9 @@ type Menu { type MenuItem { title: String! + description: String url: String! + expanded: Boolean! inActiveTrail: Boolean! children: [MenuItem] } diff --git a/modules/thunder_gqls/src/Plugin/GraphQL/SchemaExtension/ThunderMenuSchemaExtension.php b/modules/thunder_gqls/src/Plugin/GraphQL/SchemaExtension/ThunderMenuSchemaExtension.php index b1790b388..876de95cf 100644 --- a/modules/thunder_gqls/src/Plugin/GraphQL/SchemaExtension/ThunderMenuSchemaExtension.php +++ b/modules/thunder_gqls/src/Plugin/GraphQL/SchemaExtension/ThunderMenuSchemaExtension.php @@ -52,7 +52,7 @@ public function registerResolvers(ResolverRegistryInterface $registry): void { ); - // Menu title. + // Menu item title. $this->addFieldResolverIfNotExists( 'MenuItem', 'title', @@ -64,7 +64,31 @@ public function registerResolvers(ResolverRegistryInterface $registry): void { ) ); - // Menu in active trail. + // Menu item description. + $this->addFieldResolverIfNotExists( + 'MenuItem', + 'description', + $this->builder->produce('menu_link_description') + ->map( + 'link', + $this->builder->produce('menu_tree_link') + ->map('element', $this->builder->fromParent()) + ) + ); + + // Menu item expanded. + $this->addFieldResolverIfNotExists( + 'MenuItem', + 'expanded', + $this->builder->produce('menu_link_expanded') + ->map( + 'link', + $this->builder->produce('menu_tree_link') + ->map('element', $this->builder->fromParent()) + ) + ); + + // Menu item in active trail. $this->addFieldResolverIfNotExists( 'MenuItem', 'inActiveTrail', @@ -72,7 +96,7 @@ public function registerResolvers(ResolverRegistryInterface $registry): void { ->map('element', $this->builder->fromParent()) ); - // Menu children. + // Menu item children. $this->addFieldResolverIfNotExists( 'MenuItem', 'children', @@ -80,7 +104,7 @@ public function registerResolvers(ResolverRegistryInterface $registry): void { ->map('element', $this->builder->fromParent()) ); - // Menu url. + // Menu item url. $this->addFieldResolverIfNotExists( 'MenuItem', 'url',