protected function 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;
}

© 2001–2016 by the original authors
Licensed under the GNU General Public License, version 2 and later.
Drupal is a registered trademark of Dries Buytaert.
https://api.drupal.org/api/drupal/core!lib!Drupal!Core!Entity!EntityDisplayRepository.php/function/EntityDisplayRepository::getDisplayModeOptions/8.1.x