You are here

public function InlineParagraphsWidget::settingsSummary in Paragraphs Sets 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 InlineParagraphsWidget::settingsSummary

File

src/Plugin/Field/FieldWidget/InlineParagraphsWidget.php, line 49

Class

InlineParagraphsWidget
Plugin definition of the 'entity_reference paragraphs sets' widget.

Namespace

Drupal\paragraphs_sets\Plugin\Field\FieldWidget

Code

public function settingsSummary() {
  $summary = parent::settingsSummary();
  if ($this
    ->getDefaultParagraphTypeLabelName() !== NULL) {

    // Find "Default paragraph type" in summary and replace it.
    foreach ($summary as $key => $value) {
      if (strpos($value, 'Default paragraph type') !== 0) {
        continue;
      }
      $summary[$key] = $this
        ->t('Default paragraphs set: @default_paragraph_set', [
        '@default_paragraph_set' => $this
          ->getDefaultParagraphTypeLabelName(),
      ]);
    }
  }
  return $summary;
}