You are here

public function StringMiconWidget::settingsSummary in Micon 8

Same name and namespace in other branches
  1. 2.x src/Plugin/Field/FieldWidget/StringMiconWidget.php \Drupal\micon\Plugin\Field\FieldWidget\StringMiconWidget::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/StringMiconWidget.php, line 66

Class

StringMiconWidget
Plugin implementation of the 'string_micon' widget.

Namespace

Drupal\micon\Plugin\Field\FieldWidget

Code

public function settingsSummary() {
  $summary = parent::settingsSummary();
  $enabled_packages = array_filter($this
    ->getSetting('packages'));
  if ($enabled_packages) {
    $enabled_packages = array_intersect_key(Micon::loadActiveLabels(), $enabled_packages);
    $summary[] = $this
      ->t('With icon packages: @packages', array(
      '@packages' => implode(', ', $enabled_packages),
    ));
  }
  else {
    $summary[] = $this
      ->t('With icon packages: @packages', array(
      '@packages' => 'All',
    ));
  }
  return $summary;
}