public function ChildEntityWarning::getList in Entity Reference Hierarchy 3.x
Same name and namespace in other branches
- 8.2 src/Information/ChildEntityWarning.php \Drupal\entity_hierarchy\Information\ChildEntityWarning::getList()
Gets render array for child entity list.
Return value
array Render array.
File
- src/
Information/ ChildEntityWarning.php, line 59
Class
- ChildEntityWarning
- Defines a value object for a child entity warning.
Namespace
Drupal\entity_hierarchy\InformationCode
public function getList() {
$child_labels = [];
$build = [
'#theme' => 'item_list',
];
foreach ($this->relatedEntities as $node) {
if (!$this->relatedEntities
->contains($node) || $node == $this->parent) {
continue;
}
$child_labels[] = $this->relatedEntities
->offsetGet($node)
->label();
}
$build['#items'] = array_unique($child_labels);
$this->cache
->applyTo($build);
return $build;
}