You are here

public function WidgetBase::settingsSummary in Select (or other) 4.x

Same name and namespace in other branches
  1. 8 src/Plugin/Field/FieldWidget/WidgetBase.php \Drupal\select_or_other\Plugin\Field\FieldWidget\WidgetBase::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 WidgetBase::settingsSummary

File

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

Class

WidgetBase
Base class for the 'select_or_other_*' widgets.

Namespace

Drupal\select_or_other\Plugin\Field\FieldWidget

Code

public function settingsSummary() {
  $summary = parent::settingsSummary();
  $options = $this
    ->selectElementTypeOptions();
  $summary[] = $this
    ->t('Type of select form element') . ': ' . $options[$this
    ->getSetting('select_element_type')];
  if ($option = $this
    ->getSetting('sort_options')) {
    $options = $this
      ->getAvailableSortOptions();
    $summary[] = $options[$option];
  }
  return $summary;
}