You are here

public function LayoutParagraphsWidget::settingsSummary in Layout Paragraphs 2.0.x

Same name and namespace in other branches
  1. 1.0.x src/Plugin/Field/FieldWidget/LayoutParagraphsWidget.php \Drupal\layout_paragraphs\Plugin\Field\FieldWidget\LayoutParagraphsWidget::settingsSummary()

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/LayoutParagraphsWidget.php, line 221

Class

LayoutParagraphsWidget
Layout paragraphs widget.

Namespace

Drupal\layout_paragraphs\Plugin\Field\FieldWidget

Code

public function settingsSummary() {
  $summary = parent::settingsSummary();
  $summary[] = $this
    ->t('Preview view mode: @preview_view_mode', [
    '@preview_view_mode' => $this
      ->getSetting('preview_view_mode'),
  ]);
  $summary[] = $this
    ->t('Maximum nesting depth: @max_depth', [
    '@max_depth' => $this
      ->getSetting('nesting_depth'),
  ]);
  if ($this
    ->getSetting('require_layouts')) {
    $summary[] = $this
      ->t('Paragraphs <b>must be</b> added within layouts.');
  }
  else {
    $summary[] = $this
      ->t('Layouts are optional.');
  }
  $summary[] = $this
    ->t('Maximum nesting depth: @max_depth', [
    '@max_depth' => $this
      ->getSetting('nesting_depth'),
  ]);
  return $summary;
}