You are here

protected function EntityDisplayRepository::getDisplayModesByEntityType in Drupal 8

Same name and namespace in other branches
  1. 9 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\Entity

Code

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 [];
}