You are here

public function MenuTreeSubtree::resolve in GraphQL 8.4

Resolver.

Parameters

\Drupal\Core\Menu\MenuLinkTreeElement $element:

Return value

\Drupal\Core\Menu\MenuLinkTreeElement[]

File

src/Plugin/GraphQL/DataProducer/Menu/MenuTree/MenuTreeSubtree.php, line 37

Class

MenuTreeSubtree
Returns a list of menu links under the menu tree element.

Namespace

Drupal\graphql\Plugin\GraphQL\DataProducer\Menu\MenuTree

Code

public function resolve(MenuLinkTreeElement $element) {
  return array_filter($element->subtree, function (MenuLinkTreeElement $item) {
    return $item->link
      ->isEnabled();
  });
}