You are here

public function FaqFieldAccordionFormatter::settingsSummary in FAQ Field 8

Same name and namespace in other branches
  1. 2.0.x src/Plugin/Field/FieldFormatter/FaqFieldAccordionFormatter.php \Drupal\faqfield\Plugin\Field\FieldFormatter\FaqFieldAccordionFormatter::settingsSummary()

Returns a short summary for the current formatter settings.

If an empty result is returned, a UI can still be provided to display a settings form in case the formatter has configurable settings.

Return value

string[] A short summary of the formatter settings.

Overrides FormatterBase::settingsSummary

File

src/Plugin/Field/FieldFormatter/FaqFieldAccordionFormatter.php, line 109

Class

FaqFieldAccordionFormatter
Plugin implementation of the 'faqfield_accordion' formatter.

Namespace

Drupal\faqfield\Plugin\Field\FieldFormatter

Code

public function settingsSummary() {
  $summary = [];
  if (is_numeric($this
    ->getSetting('active'))) {
    $active = $this
      ->getSetting('active');
  }
  else {
    $active = $this
      ->t('None');
  }
  $summary[] = $this
    ->t('Default active: @element', [
    '@element' => $active,
  ]);
  $height_style = '';
  switch ($this
    ->getSetting('heightStyle')) {
    case 'auto':
      $height_style = $this
        ->t('Auto');
      break;
    case 'fill':
      $height_style = $this
        ->t('Fill');
      break;
    case 'content':
      $height_style = $this
        ->t('Content');
      break;
  }
  $summary[] = $this
    ->t('Height style : @style', [
    '@style' => $height_style,
  ]);
  if ($this
    ->getSetting('collapsible')) {
    $summary[] = $this
      ->t('Fully collapsible');
  }
  $summary[] = $this
    ->t('Event: @event', [
    '@event' => $this
      ->getSetting('event'),
  ]);
  return $summary;
}