function EntityDisplayRepository::getViewModeOptionsByBundle

Returns an array of enabled view mode options by bundle.

Parameters

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

string $bundle: The name of the bundle.

Return value

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

Overrides EntityDisplayRepositoryInterface::getViewModeOptionsByBundle

File

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

Class

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

Namespace

Drupal\Core\Entity

Code

public function getViewModeOptionsByBundle($entity_type_id, $bundle) {
  return $this->getDisplayModeOptionsByBundle('view_mode', $entity_type_id, $bundle);
}

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