function EntityDisplayRepository::getDisplayModesByEntityType
Same name in other branches
- 9 core/lib/Drupal/Core/Entity/EntityDisplayRepository.php \Drupal\Core\Entity\EntityDisplayRepository::getDisplayModesByEntityType()
- 10 core/lib/Drupal/Core/Entity/EntityDisplayRepository.php \Drupal\Core\Entity\EntityDisplayRepository::getDisplayModesByEntityType()
- 11.x core/lib/Drupal/Core/Entity/EntityDisplayRepository.php \Drupal\Core\Entity\EntityDisplayRepository::getDisplayModesByEntityType()
Gets the entity display mode info for a specific entity type.
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 info should be returned.
Return value
array The display mode info for a specific entity type.
3 calls to EntityDisplayRepository::getDisplayModesByEntityType()
- EntityDisplayRepository::getDisplayModeOptions in core/
lib/ Drupal/ Core/ Entity/ EntityDisplayRepository.php - Gets an array of display mode options.
- EntityDisplayRepository::getFormModes in core/
lib/ Drupal/ Core/ Entity/ EntityDisplayRepository.php - Gets the entity form mode info for a specific entity type.
- EntityDisplayRepository::getViewModes in core/
lib/ Drupal/ Core/ Entity/ EntityDisplayRepository.php - Gets the entity view mode info for a specific entity type.
File
-
core/
lib/ Drupal/ Core/ Entity/ EntityDisplayRepository.php, line 137
Class
- EntityDisplayRepository
- Provides a repository for entity display objects (view modes and form modes).
Namespace
Drupal\Core\EntityCode
protected function getDisplayModesByEntityType($display_type, $entity_type_id) {
if (isset($this->displayModeInfo[$display_type][$entity_type_id])) {
return $this->displayModeInfo[$display_type][$entity_type_id];
}
else {
$display_modes = $this->getAllDisplayModesByEntityType($display_type);
if (isset($display_modes[$entity_type_id])) {
return $display_modes[$entity_type_id];
}
}
return [];
}
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.