You are here

public function TaxonomyTermReferenceCsv::settingsSummary in Taxonomy Formatter 8

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/TaxonomyTermReferenceCsv.php, line 112
Contains \Drupal\taxonomy_formatter\Plugin\Field\FieldFormatter\TaxonomyTermReferenceCsv.

Class

TaxonomyTermReferenceCsv
Plugin annotation @FieldFormatter( id = "taxonomy_term_reference_csv", label = @Translation("Delimited"), field_types = { "entity_reference" } )

Namespace

Drupal\taxonomy_formatter\Plugin\Field\FieldFormatter

Code

public function settingsSummary() {
  $summary = array();
  $summary[] = t('The Terms will be displayed separated by "@separator"', array(
    '@separator' => $this
      ->getSetting('separator_option'),
  ));
  if ($this
    ->getSetting('links_option')) {
    $summary[] = $this
      ->t('<br>The terms will link to the term pages');
  }
  if ($this
    ->getSetting('element_option') != "- None -") {
    $summary[] = t('<br>Elements will be wrapped in a "@element" tag', array(
      '@element' => $this
        ->getSetting('element_option'),
    ));
    if (!empty($settings['element_class'])) {
      $summary[] = t(' with the class of @elemclass', array(
        '@elemclass' => $this
          ->getSetting('element_class'),
      ));
    }
  }
  if ($this
    ->getSetting('wrapper_option') != "- None -") {
    $summary[] = t('<br>The entire list will be wrapped in a "@wrapper" tag', array(
      '@wrapper' => $this
        ->getSetting('wrapper_option'),
    ));
    if (!empty($settings['wrapper_class'])) {
      $summary[] = t(' with the class of @wrapclass', array(
        '@wrapclass' => $this
          ->getSetting('wrapper_class'),
      ));
    }
  }
  return $summary;
}