function BooleanFormatter::settingsSummary

Same name in other branches
  1. 9 core/lib/Drupal/Core/Field/Plugin/Field/FieldFormatter/BooleanFormatter.php \Drupal\Core\Field\Plugin\Field\FieldFormatter\BooleanFormatter::settingsSummary()
  2. 8.9.x core/lib/Drupal/Core/Field/Plugin/Field/FieldFormatter/BooleanFormatter.php \Drupal\Core\Field\Plugin\Field\FieldFormatter\BooleanFormatter::settingsSummary()
  3. 11.x core/lib/Drupal/Core/Field/Plugin/Field/FieldFormatter/BooleanFormatter.php \Drupal\Core\Field\Plugin\Field\FieldFormatter\BooleanFormatter::settingsSummary()

Overrides FormatterBase::settingsSummary

File

core/lib/Drupal/Core/Field/Plugin/Field/FieldFormatter/BooleanFormatter.php, line 116

Class

BooleanFormatter
Plugin implementation of the 'boolean' formatter.

Namespace

Drupal\Core\Field\Plugin\Field\FieldFormatter

Code

public function settingsSummary() {
    $summary = [];
    $setting = $this->getSetting('format');
    if ($setting == 'custom') {
        $summary[] = $this->t('Custom text: @true_label / @false_label', [
            '@true_label' => $this->getSetting('format_custom_true'),
            '@false_label' => $this->getSetting('format_custom_false'),
        ]);
    }
    else {
        $formats = $this->getOutputFormats();
        $summary[] = $this->t('Display: @true_label / @false_label', [
            '@true_label' => $formats[$setting][0],
            '@false_label' => $formats[$setting][1],
        ]);
    }
    return $summary;
}

Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.