function EntityDisplayRepository::getViewModeOptions

Gets an array of view mode options.

Parameters

string $entity_type_id: The entity type whose view mode options should be returned.

Return value

array An associative array containing view mode options for the specified entity type. The array is keyed by the display mode ID, and each value is a view mode label.

Overrides EntityDisplayRepositoryInterface::getViewModeOptions

File

core/lib/Drupal/Core/Entity/EntityDisplayRepository.php, line 156

Class

EntityDisplayRepository
Provides a repository for entity display objects (view modes and form modes).

Namespace

Drupal\Core\Entity

Code

public function getViewModeOptions($entity_type) {
  return $this->getDisplayModeOptions('view_mode', $entity_type);
}

Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.