function EntityDisplayRepository::getDisplayModeOptions
Same name in other branches
- 9 core/lib/Drupal/Core/Entity/EntityDisplayRepository.php \Drupal\Core\Entity\EntityDisplayRepository::getDisplayModeOptions()
- 8.9.x core/lib/Drupal/Core/Entity/EntityDisplayRepository.php \Drupal\Core\Entity\EntityDisplayRepository::getDisplayModeOptions()
- 10 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.
3 calls to EntityDisplayRepository::getDisplayModeOptions()
- EntityDisplayRepository::getDisplayModeOptionsByBundle in core/
lib/ Drupal/ Core/ Entity/ EntityDisplayRepository.php - Returns an array of enabled display mode options by bundle.
- EntityDisplayRepository::getFormModeOptions in core/
lib/ Drupal/ Core/ Entity/ EntityDisplayRepository.php - Gets an array of form mode options.
- EntityDisplayRepository::getViewModeOptions in core/
lib/ Drupal/ Core/ Entity/ EntityDisplayRepository.php - Gets an array of view mode options.
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' => $this->t('Default'),
];
foreach ($this->getDisplayModesByEntityType($display_type, $entity_type_id) as $mode => $settings) {
$options[$mode] = $settings['label'];
}
return $options;
}
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.