You are here

private function EntityBlockWidget::getViewModes in Entityblock 8

Helper function to return a list of view modes.

3 calls to EntityBlockWidget::getViewModes()
EntityBlockWidget::formElement in src/Plugin/Field/FieldWidget/EntityBlockWidget.php
Returns the form for a single field widget.
EntityBlockWidget::settingsForm in src/Plugin/Field/FieldWidget/EntityBlockWidget.php
Returns a form to configure settings for the widget.
EntityBlockWidget::settingsSummary in src/Plugin/Field/FieldWidget/EntityBlockWidget.php
Returns a short summary for the current widget settings.

File

src/Plugin/Field/FieldWidget/EntityBlockWidget.php, line 230
Contains \Drupal\entityblock\Plugin\Field\FieldWidget\EntityBlockWidget.

Class

EntityBlockWidget
Plugin implementation of the 'EntityBlock' widget.

Namespace

Drupal\entityblock\Plugin\Field\FieldWidget

Code

private function getViewModes() {
  return array_map(function ($view_mode) {
    return $view_mode['label'];
  }, \Drupal::service('entity_display.repository')
    ->getViewModes($this->fieldDefinition
    ->getTargetEntityTypeId()));
}