public function TreeItem::addLeave in Views tree 8.2
Adds a leaf.
Parameters
mixed $item: An item to add. If not an instance of \Drupal\views_tree\TreeItem it will be converted.
Return value
$this
File
- src/
TreeItem.php, line 103
Class
- TreeItem
- Defines a tree item class.
Namespace
Drupal\views_treeCode
public function addLeave($item) {
if (!$item instanceof static) {
$item = new TreeItem($item);
}
$this->leaves[] = $item;
return $this;
}