You are here

protected function ParagraphViewModeWidget::getEnabledViewModes in Paragraph View Mode 8

Same name and namespace in other branches
  1. 2.x src/Plugin/Field/FieldWidget/ParagraphViewModeWidget.php \Drupal\paragraph_view_mode\Plugin\Field\FieldWidget\ParagraphViewModeWidget::getEnabledViewModes()

Getter for enabled view modes.

Return value

array Associative array of view mode machine names and labels.

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

File

src/Plugin/Field/FieldWidget/ParagraphViewModeWidget.php, line 194

Class

ParagraphViewModeWidget
Plugin implementation of the 'paragraph_view_mode' widget.

Namespace

Drupal\paragraph_view_mode\Plugin\Field\FieldWidget

Code

protected function getEnabledViewModes() {
  $availableViewModes = self::getAvailableViewModes();
  $currentViewModes = array_filter($this
    ->getSetting('view_modes'));
  return array_intersect_key($availableViewModes, $currentViewModes);
}