You are here

public function DefaultParagraphsWidget::settingsSummary in Default Paragraphs 8

Returns a short summary for the current widget settings.

If an empty result is returned, a UI can still be provided to display a settings form in case the widget has configurable settings.

Return value

array A short summary of the widget settings.

Overrides ParagraphsWidget::settingsSummary

File

src/Plugin/Field/FieldWidget/DefaultParagraphsWidget.php, line 289

Class

DefaultParagraphsWidget
Plugin implementation of the 'entity_reference_revisions paragraphs' widget.

Namespace

Drupal\default_paragraphs\Plugin\Field\FieldWidget

Code

public function settingsSummary() {
  $summary = [];
  $summary[] = $this
    ->t('Title: @title', [
    '@title' => $this
      ->getSetting('title'),
  ]);
  $summary[] = $this
    ->t('Plural title: @title_plural', [
    '@title_plural' => $this
      ->getSetting('title_plural'),
  ]);
  $closed_mode = $this
    ->getSettingOptions('closed_mode')[$this
    ->getSetting('closed_mode')];
  $autocollapse = $this
    ->getSettingOptions('autocollapse')[$this
    ->getSetting('autocollapse')];
  $add_mode = $this
    ->getSettingOptions('add_mode')[$this
    ->getSetting('add_mode')];
  $summary[] = $this
    ->t('Closed mode: @closed_mode', [
    '@closed_mode' => $closed_mode,
  ]);
  $summary[] = $this
    ->t('Autocollapse: @autocollapse', [
    '@autocollapse' => $autocollapse,
  ]);
  $summary[] = $this
    ->t('Add mode: @add_mode', [
    '@add_mode' => $add_mode,
  ]);
  $summary[] = $this
    ->t('Form display mode: @form_display_mode', [
    '@form_display_mode' => $this
      ->getSetting('form_display_mode'),
  ]);
  return $summary;
}