protected function EntityDisplayRepository::getDisplayModeOptions in Drupal 10
Same name and namespace in other branches
- 8 core/lib/Drupal/Core/Entity/EntityDisplayRepository.php \Drupal\Core\Entity\EntityDisplayRepository::getDisplayModeOptions()
- 9 core/lib/Drupal/Core/Entity/EntityDisplayRepository.php \Drupal\Core\Entity\EntityDisplayRepository::getDisplayModeOptions()
Gets an array of display mode options.
Parameters
string $display_type: The display type to be retrieved. It can be "view_mode" or "form_mode".
string $entity_type_id: The entity type whose display mode options should be returned.
Return value
array An array of display mode labels, keyed by the display mode ID.
File
- core/
lib/ Drupal/ Core/ Entity/ EntityDisplayRepository.php, line 189
Class
- EntityDisplayRepository
- Provides a repository for entity display objects (view modes and form modes).
Namespace
Drupal\Core\EntityCode
protected function getDisplayModeOptions($display_type, $entity_type_id) {
$options = [
'default' => t('Default'),
];
foreach ($this
->getDisplayModesByEntityType($display_type, $entity_type_id) as $mode => $settings) {
$options[$mode] = $settings['label'];
}
return $options;
}