You are here

public function FontawesomeIconpicker::settingsSummary in Font Awesome Iconpicker 8

Same name in this branch
  1. 8 src/Plugin/Field/FieldFormatter/FontawesomeIconpicker.php \Drupal\fontawesome_iconpicker\Plugin\Field\FieldFormatter\FontawesomeIconpicker::settingsSummary()
  2. 8 src/Plugin/Field/FieldWidget/FontawesomeIconpicker.php \Drupal\fontawesome_iconpicker\Plugin\Field\FieldWidget\FontawesomeIconpicker::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/FontawesomeIconpicker.php, line 70

Class

FontawesomeIconpicker
Plugin implementation of the 'fontawesome_iconpicker' widget.

Namespace

Drupal\fontawesome_iconpicker\Plugin\Field\FieldWidget

Code

public function settingsSummary() {
  $summary = [];
  if (!empty($this
    ->getSetting('type'))) {
    $label = $this
      ->getIconPickerTypes()[$this
      ->getSetting('type')];
    $summary[] = t('Type: @type', [
      '@type' => $label,
    ]);
  }
  if (!empty($this
    ->getSetting('placeholder'))) {
    $summary[] = t('Placeholder: @placeholder', [
      '@placeholder' => $this
        ->getSetting('placeholder'),
    ]);
  }
  if (!empty($this
    ->getSetting('size'))) {
    $summary[] = t('Field size: @size', [
      '@size' => $this
        ->getSetting('size'),
    ]);
  }
  return $summary;
}