protected function FormatterForm::getDependentEntitiesList in Custom Formatters 8.3
Returns a list of dependent entities.
Parameters
array $entities: The dependent entities.
Return value
mixed|null The rendered list of dependent entities.
1 call to FormatterForm::getDependentEntitiesList()
- FormatterForm::form in src/
Form/ FormatterForm.php - Gets the actual form array to be built.
File
- src/
Form/ FormatterForm.php, line 244
Class
- FormatterForm
- Form controller for the shortcut set entity edit forms.
Namespace
Drupal\custom_formatters\FormCode
protected function getDependentEntitiesList(array $entities = []) {
$list = [];
foreach ($entities as $entity) {
$entity_type_id = $entity
->getEntityTypeId();
if (!isset($list[$entity_type_id])) {
$entity_type = $this->entityTypeManager
->getDefinition($entity_type_id);
// Store the ID and label to sort the entity types and entities later.
$label = $entity_type
->getLabel();
$list[$entity_type_id] = [
'#theme' => 'item_list',
'#title' => $label,
'#items' => [],
];
}
$list[$entity_type_id]['#items'][$entity
->id()] = $entity
->label() ?: $entity
->id();
}
return render($list);
}