You are here

public function RangeWidget::settingsSummary in Range 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/RangeWidget.php, line 79

Class

RangeWidget
Plugin implementation of the 'range' widget.

Namespace

Drupal\range\Plugin\Field\FieldWidget

Code

public function settingsSummary() {
  $summary = [];
  $summary[] = $this
    ->t('FROM form element label: @label', [
    '@label' => $this
      ->getSetting('label')['from'],
  ]);
  $summary[] = $this
    ->t('TO form element label: @label', [
    '@label' => $this
      ->getSetting('label')['to'],
  ]);
  $placeholder = $this
    ->getSetting('placeholder');
  $summary[] = !empty($placeholder['from']) ? $this
    ->t('FROM placeholder: @placeholder', [
    '@placeholder' => $placeholder['from'],
  ]) : $this
    ->t('No FROM placeholder');
  $summary[] = !empty($placeholder['to']) ? $this
    ->t('TO placeholder: @placeholder', [
    '@placeholder' => $placeholder['to'],
  ]) : $this
    ->t('No TO placeholder');
  return $summary;
}