You are here

protected function ParagraphsBrowserWidget::getSettingOptions in Paragraphs Browser 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/ParagraphsBrowserWidget.php, line 67
Paragraphs Previewer widget implementation for paragraphs.

Class

ParagraphsBrowserWidget
Plugin implementation of the 'entity_reference paragraphs' widget.

Namespace

Drupal\paragraphs_browser\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;
}