You are here

public function RangeSliderWidget::settingsSummary in Range Slider 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/RangeSliderWidget.php, line 69

Class

RangeSliderWidget
Plugin implementation of the 'range' widget.

Namespace

Drupal\range_slider\Plugin\Field\FieldWidget

Code

public function settingsSummary() {
  $summary = [];
  $widget_settings = $this
    ->getSettings();
  if (!empty($widget_settings['orientation'])) {
    $summary[] = $this
      ->t('Orientation: @orientation', [
      '@orientation' => ucfirst($widget_settings['orientation']),
    ]);
  }
  else {
    $summary[] = $this
      ->t('No orientation');
  }
  if (!empty($widget_settings['output']) && $widget_settings['output'] !== self::OPTION_NONE) {
    $summary[] = $this
      ->t('Output: @output', [
      '@output' => ucfirst($widget_settings['output']),
    ]);
  }
  else {
    $summary[] = $this
      ->t('No output');
  }
  return $summary;
}