EntityDisplayRepository::getDisplayModeOptions

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

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\Entity

Code

protected function getDisplayModeOptions($display_type, $entity_type_id) {
  $options = array('default' => t('Default'));
  foreach ($this->getDisplayModesByEntityType($display_type, $entity_type_id) as $mode => $settings) {
    $options[$mode] = $settings['label'];
  }
  return $options;
}
doc_Drupal
2016-10-29 09:05:52
Comments
Leave a Comment

Please login to continue.