You are here

public function LinkWithAttributesWidget::settingsSummary in Link Attributes widget 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 LinkWidget::settingsSummary

File

src/Plugin/Field/FieldWidget/LinkWithAttributesWidget.php, line 169

Class

LinkWithAttributesWidget
Plugin implementation of the 'link' widget.

Namespace

Drupal\link_attributes\Plugin\Field\FieldWidget

Code

public function settingsSummary() {
  $summary = parent::settingsSummary();
  $enabled_attributes = array_filter($this
    ->getSetting('enabled_attributes'));
  if ($enabled_attributes) {
    $summary[] = $this
      ->t('With attributes: @attributes', [
      '@attributes' => implode(', ', array_keys($enabled_attributes)),
    ]);
  }
  return $summary;
}