function EntityDisplayModeFormBase::getViewDisplay

Same name in other branches
  1. 11.x core/modules/field_ui/src/Form/EntityDisplayModeFormBase.php \Drupal\field_ui\Form\EntityDisplayModeFormBase::getViewDisplay()

Load the view display for a given bundle and view mode name.

Parameters

string $bundle: The entity bundle to load the view display for.

string $view_mode_name: The view mode name such as "full_content" to load the view display for.

Return value

\Drupal\Core\Entity\Display\EntityViewDisplayInterface|null Returns the view display, or NULL if one does not exist.

File

core/modules/field_ui/src/Form/EntityDisplayModeFormBase.php, line 262

Class

EntityDisplayModeFormBase
Provides the generic base class for entity display mode forms.

Namespace

Drupal\field_ui\Form

Code

private function getViewDisplay(string $bundle, string $view_mode_name) : ?EntityViewDisplayInterface {
    $view_mode_id = $this->targetEntityTypeId . '.' . $bundle . '.' . $view_mode_name;
    return $this->entityTypeManager
        ->getStorage('entity_view_display')
        ->load($view_mode_id);
}

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