You are here

public function LinkClassFieldWidget::settingsSummary in Link class 8

Same name and namespace in other branches
  1. 2.0.x src/Plugin/Field/FieldWidget/LinkClassFieldWidget.php \Drupal\link_class\Plugin\Field\FieldWidget\LinkClassFieldWidget::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 LinkWidget::settingsSummary

File

src/Plugin/Field/FieldWidget/LinkClassFieldWidget.php, line 98

Class

LinkClassFieldWidget
Plugin implementation of the 'link_class_field_widget' widget.

Namespace

Drupal\link_class\Plugin\Field\FieldWidget

Code

public function settingsSummary() {
  $summary = parent::settingsSummary();
  $option = $this
    ->getSetting('link_class_mode');
  $summary[] = $this
    ->t('Mode: @link_class_mode', [
    '@link_class_mode' => $this
      ->getModeOptions($option),
  ]);
  if ($option == 'force_class') {
    $summary[] = $this
      ->t('Class(es) added: @link_class_force', [
      '@link_class_force' => $this
        ->getSetting('link_class_force'),
    ]);
  }
  if ($option == 'select_class') {
    $classes_available = $this
      ->getSelectOptions($this
      ->getSetting('link_class_select'), TRUE);
    $summary[] = $this
      ->t('Class(es) available: @link_class_select', [
      '@link_class_select' => $classes_available,
    ]);
  }
  return $summary;
}