You are here

public function OptionsShsWidget::settingsSummary in Simple hierarchical select 2.0.x

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

1 call to OptionsShsWidget::settingsSummary()
OptionsShsChosenWidget::settingsSummary in modules/shs_chosen/src/Plugin/Field/FieldWidget/OptionsShsChosenWidget.php
Returns a short summary for the current widget settings.
1 method overrides OptionsShsWidget::settingsSummary()
OptionsShsChosenWidget::settingsSummary in modules/shs_chosen/src/Plugin/Field/FieldWidget/OptionsShsChosenWidget.php
Returns a short summary for the current widget settings.

File

src/Plugin/Field/FieldWidget/OptionsShsWidget.php, line 128

Class

OptionsShsWidget
Plugin implementation of the 'options_shs' widget.

Namespace

Drupal\shs\Plugin\Field\FieldWidget

Code

public function settingsSummary() {
  $summary = parent::settingsSummary();
  if ($this
    ->getSetting('create_new_items')) {
    $summary[] = $this
      ->t('Allow creation of new items');
    if ($this
      ->getSetting('create_new_levels')) {
      $summary[] = $this
        ->t('Allow creation of new levels');
    }
    else {
      $summary[] = $this
        ->t('Do not allow creation of new levels');
    }
  }
  else {
    $summary[] = $this
      ->t('Do not allow creation of new items');
  }
  if ($this
    ->getSetting('force_deepest')) {
    $summary[] = $this
      ->t('Force selection of deepest level');
  }
  else {
    $summary[] = $this
      ->t('Do not force selection of deepest level');
  }
  return $summary;
}