You are here

protected function ParagraphsBrowserPreviewerWidget::getSettingOptions in Paragraphs Browser+Previewer 8

Returns select options for a plugin setting.

This is done to allow \Drupal\paragraphs\Plugin\Field\FieldWidget\ParagraphsWidget::settingsSummary() to access option labels. Not all plugin setting are available.

Parameters

string $setting_name: The name of the widget setting. Supported settings:

  • "edit_mode"
  • "closed_mode"
  • "autocollapse"
  • "add_mode",

Return value

array|null An array of setting option usable as a value for a "#options" key.

Overrides ParagraphsWidget::getSettingOptions

See also

\Drupal\paragraphs\Plugin\Field\FieldWidget\ParagraphsWidget::settingsSummary()

File

src/Plugin/Field/FieldWidget/ParagraphsBrowserPreviewerWidget.php, line 51

Class

ParagraphsBrowserPreviewerWidget
Plugin implementation of the 'entity_reference paragraphs' widget.

Namespace

Drupal\paragraphs_browser_previewer\Plugin\Field\FieldWidget

Code

protected function getSettingOptions($setting_name) {
  $options = parent::getSettingOptions($setting_name);
  switch ($setting_name) {
    case 'add_mode':
      $options['paragraphs_browser'] = $this
        ->t('Paragraphs Browser');
      break;
  }
  return $options;
}