public function TermName::getItems in Drupal 10
Same name and namespace in other branches
- 8 core/modules/taxonomy/src/Plugin/views/field/TermName.php \Drupal\taxonomy\Plugin\views\field\TermName::getItems()
- 9 core/modules/taxonomy/src/Plugin/views/field/TermName.php \Drupal\taxonomy\Plugin\views\field\TermName::getItems()
File
- core/
modules/ taxonomy/ src/ Plugin/ views/ field/ TermName.php, line 21
Class
- TermName
- Displays taxonomy term names and allows converting spaces to hyphens.
Namespace
Drupal\taxonomy\Plugin\views\fieldCode
public function getItems(ResultRow $values) {
$items = parent::getItems($values);
if ($this->options['convert_spaces']) {
foreach ($items as &$item) {
// Replace spaces with hyphens.
$name = $item['raw']
->get('value')
->getValue();
// @todo Add link support https://www.drupal.org/node/2567745
$item['rendered']['#context']['value'] = str_replace(' ', '-', $name);
}
}
return $items;
}