You are here

public function HtmlList::settingsSummary in Double Field 8.3

Same name and namespace in other branches
  1. 4.x src/Plugin/Field/FieldFormatter/HtmlList.php \Drupal\double_field\Plugin\Field\FieldFormatter\HtmlList::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 ListBase::settingsSummary

File

src/Plugin/Field/FieldFormatter/HtmlList.php, line 51

Class

HtmlList
Plugin implementations for 'html_list' formatter.

Namespace

Drupal\double_field\Plugin\Field\FieldFormatter

Code

public function settingsSummary() {
  $parent_summary = parent::settingsSummary();

  // Definition list does not support 'inline' option.
  $list_type = $this
    ->getSetting('list_type');
  if ($list_type == 'dl') {
    if (($key = array_search($this
      ->t('Display as inline element'), $parent_summary)) !== FALSE) {
      unset($parent_summary[$key]);
    }
  }
  $summary[] = $this
    ->t('List type: @list_type', [
    '@list_type' => $this
      ->getSetting('list_type'),
  ]);
  return array_merge($summary, $parent_summary);
}