function TermName::getItems
Gets an array of items for the field.
Parameters
\Drupal\views\ResultRow $values: The result row object containing the values.
Return value
array An array of items for the field.
Overrides EntityField::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 = str_replace(' ', '-', $item['raw']->get('value')
        ->getValue());
      empty($this->options['settings']['link_to_entity']) ? $item['rendered']['#context']['value'] = $name : $item['rendered']['#title']['#context']['value'] = $name;
    }
  }
  return $items;
}
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.