function MenuLinkTreeElement::__construct

Same name and namespace in other branches
  1. 9 core/lib/Drupal/Core/Menu/MenuLinkTreeElement.php \Drupal\Core\Menu\MenuLinkTreeElement::__construct()
  2. 8.9.x core/lib/Drupal/Core/Menu/MenuLinkTreeElement.php \Drupal\Core\Menu\MenuLinkTreeElement::__construct()
  3. 10 core/lib/Drupal/Core/Menu/MenuLinkTreeElement.php \Drupal\Core\Menu\MenuLinkTreeElement::__construct()

Constructs a new \Drupal\Core\Menu\MenuLinkTreeElement.

Parameters

\Drupal\Core\Menu\MenuLinkInterface $link: The menu link for this element in the menu link tree.

bool $has_children: A flag as to whether this element has children even if they are not included in the tree (i.e. this may be TRUE even if $subtree is empty).

int $depth: The depth of this element relative to the tree root.

bool $in_active_trail: A flag as to whether this link was included in the list of active trail IDs used to build the tree.

\Drupal\Core\Menu\MenuLinkTreeElement[] $subtree: The children of this element in the menu link tree.

File

core/lib/Drupal/Core/Menu/MenuLinkTreeElement.php, line 100

Class

MenuLinkTreeElement
Provides a value object to model an element in a menu link tree.

Namespace

Drupal\Core\Menu

Code

public function __construct(MenuLinkInterface $link, $has_children, $depth, $in_active_trail, array $subtree) {
    // Essential properties.
    $this->link = $link;
    $this->hasChildren = $has_children;
    $this->depth = $depth;
    $this->subtree = $subtree;
    $this->inActiveTrail = $in_active_trail;
}

Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.