You are here

public function Table::settingsSummary in Double Field 4.x

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

File

src/Plugin/Field/FieldFormatter/Table.php, line 67

Class

Table
Plugin implementations for 'table' formatter.

Namespace

Drupal\double_field\Plugin\Field\FieldFormatter

Code

public function settingsSummary() : array {
  $settings = $this
    ->getSettings();
  $summary[] = $this
    ->t('Enable row number column: @number_column', [
    '@number_column' => $settings['number_column'] ? $this
      ->t('yes') : $this
      ->t('no'),
  ]);
  if ($settings['number_column']) {
    $summary[] = $this
      ->t('Number column label: @number_column_label', [
      '@number_column_label' => $settings['number_column_label'],
    ]);
  }
  if ($settings['first_column_label'] != '') {
    $summary[] = $this
      ->t('First column label: @first_column_label', [
      '@first_column_label' => $settings['first_column_label'],
    ]);
  }
  if ($settings['second_column_label'] != '') {
    $summary[] = $this
      ->t('Second column label: @second_column_label', [
      '@second_column_label' => $settings['second_column_label'],
    ]);
  }
  return array_merge($summary, parent::settingsSummary());
}