function NumberListField::summaryName

Same name and namespace in other branches
  1. 9 core/modules/options/src/Plugin/views/argument/NumberListField.php \Drupal\options\Plugin\views\argument\NumberListField::summaryName()
  2. 8.9.x core/modules/options/src/Plugin/views/argument/NumberListField.php \Drupal\options\Plugin\views\argument\NumberListField::summaryName()
  3. 11.x core/modules/options/src/Plugin/views/argument/NumberListField.php \Drupal\options\Plugin\views\argument\NumberListField::summaryName()

Provides the name to use for the summary, defaults to the name field.

Parameters

$data: The query results for the row.

Overrides ArgumentPluginBase::summaryName

File

core/modules/options/src/Plugin/views/argument/NumberListField.php, line 73

Class

NumberListField
Argument handler for list field to show human readable name in the summary.

Namespace

Drupal\options\Plugin\views\argument

Code

public function summaryName($data) {
  $value = $data->{$this->name_alias};
  // If the list element has a human readable name show it.
  if (isset($this->allowedValues[$value]) && !empty($this->options['summary']['human'])) {
    return FieldFilteredMarkup::create($this->allowedValues[$value]);
  }
  else {
    return $value;
  }
}

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