public function EntityDisplayModeController::viewModeTypeSelection in Drupal 10
Same name and namespace in other branches
- 8 core/modules/field_ui/src/Controller/EntityDisplayModeController.php \Drupal\field_ui\Controller\EntityDisplayModeController::viewModeTypeSelection()
- 9 core/modules/field_ui/src/Controller/EntityDisplayModeController.php \Drupal\field_ui\Controller\EntityDisplayModeController::viewModeTypeSelection()
Provides a list of eligible entity types for adding view modes.
Return value
array A list of entity types to add a view mode for.
1 string reference to 'EntityDisplayModeController::viewModeTypeSelection'
- field_ui.routing.yml in core/
modules/ field_ui/ field_ui.routing.yml - core/modules/field_ui/field_ui.routing.yml
File
- core/
modules/ field_ui/ src/ Controller/ EntityDisplayModeController.php, line 19
Class
- EntityDisplayModeController
- Provides methods for entity display mode routes.
Namespace
Drupal\field_ui\ControllerCode
public function viewModeTypeSelection() {
$entity_types = [];
foreach ($this
->entityTypeManager()
->getDefinitions() as $entity_type_id => $entity_type) {
if ($entity_type
->get('field_ui_base_route') && $entity_type
->hasViewBuilderClass()) {
$entity_types[$entity_type_id] = [
'title' => $entity_type
->getLabel(),
'url' => Url::fromRoute('entity.entity_view_mode.add_form', [
'entity_type_id' => $entity_type_id,
]),
'localized_options' => [],
];
}
}
return [
'#theme' => 'admin_block_content',
'#content' => $entity_types,
];
}