EntityDisplayRepository::getDisplayModesByEntityType

protected EntityDisplayRepository::getDisplayModesByEntityType($display_type, $entity_type_id)

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.

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 [];
}
doc_Drupal
2016-10-29 09:05:53
Comments
Leave a Comment

Please login to continue.