You are here

protected function BigMenuForm::hasAnyChildren in Big Menu 8

Same name and namespace in other branches
  1. 2.x src/BigMenuForm.php \Drupal\bigmenu\BigMenuForm::hasAnyChildren()

Checks if a MenuLinkTreeElement has any children, enabled or disabled.

Parameters

\Drupal\Core\Menu\MenuLinkTreeElement $element: The parent element.

Return value

bool TRUE if a MenuLinkTreeElement has any children, otherwise FALSE.

1 call to BigMenuForm::hasAnyChildren()
BigMenuForm::processLinks in src/BigMenuForm.php
Format the links appropriately so draggable views will work.

File

src/BigMenuForm.php, line 297

Class

BigMenuForm
Defines class for BigMenuForm.

Namespace

Drupal\bigmenu

Code

protected function hasAnyChildren(MenuLinkTreeElement $element) {
  $depth = $element->depth + 1;
  $tree_params = new MenuTreeParameters();
  $tree_params
    ->setMinDepth($depth);
  $tree_params
    ->setMaxDepth($depth);
  $tree_params
    ->addExpandedParents([
    $element->link
      ->getPluginId(),
  ]);
  $tree = $this->menuTree
    ->load($this->entity
    ->id(), $tree_params);
  return !empty($tree);
}