You are here

public function EditorNoteWidget::settingsSummary in Editor Notes 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 WidgetBase::settingsSummary

File

src/Plugin/Field/FieldWidget/EditorNoteWidget.php, line 161

Class

EditorNoteWidget
Editor note widget.

Namespace

Drupal\editor_note\Plugin\Field\FieldWidget

Code

public function settingsSummary() {
  $summary = parent::settingsSummary();
  $is_formatted = $this
    ->getSetting('formatted');
  $label = $is_formatted ? $this
    ->t('Yes') : $this
    ->t('No');
  $summary[] = $this
    ->t('Formatted: @formatted', [
    '@formatted' => $label,
  ]);
  if ($is_formatted) {
    $format = filter_formats()[$this
      ->getSetting('default_format')];
    $summary[] = $this
      ->t('Default format: @format', [
      '@format' => $format
        ->label(),
    ]);
  }
  return $summary;
}