public function TreeItem::setLeaves in Views tree 8.2
Sets the leaves.
Parameters
array $leaves: An array of leaves. If they are not already an instance of \Drupal\views_tree\TreeItem, each one will be converted.
Return value
$this The instance of the TreeItem.
1 call to TreeItem::setLeaves()
- TreeItem::__construct in src/
TreeItem.php - Creates a new TreeItem instance.
File
- src/
TreeItem.php, line 84
Class
- TreeItem
- Defines a tree item class.
Namespace
Drupal\views_treeCode
public function setLeaves(array $leaves) {
foreach ($leaves as &$leave) {
if (!$leave instanceof static) {
$leave = new TreeItem($leave);
}
}
$this->leaves = $leaves;
return $this;
}