You are here

public function RenderedEntity::getViewModeLabel in Entity Browser 8

Same name and namespace in other branches
  1. 8.2 src/Plugin/EntityBrowser/FieldWidgetDisplay/RenderedEntity.php \Drupal\entity_browser\Plugin\EntityBrowser\FieldWidgetDisplay\RenderedEntity::getViewModeLabel()

Get the label from the view mode.

Return value

string View mode label.

File

src/Plugin/EntityBrowser/FieldWidgetDisplay/RenderedEntity.php, line 90

Class

RenderedEntity
Displays the fully rendered entity.

Namespace

Drupal\entity_browser\Plugin\EntityBrowser\FieldWidgetDisplay

Code

public function getViewModeLabel() {
  if (!empty($this->configuration['entity_type']) && !empty($this->configuration['view_mode'])) {
    $view_modes = $this->entityDisplayRepository
      ->getViewModeOptions($this->configuration['entity_type']);
    return $view_modes[$this->configuration['view_mode']];
  }
  return $this
    ->t('Default');
}