You are here

public function StylePluginBase::getRowClass in Drupal 8

Same name and namespace in other branches
  1. 9 core/modules/views/src/Plugin/views/style/StylePluginBase.php \Drupal\views\Plugin\views\style\StylePluginBase::getRowClass()

Return the token replaced row class for the specified row.

File

core/modules/views/src/Plugin/views/style/StylePluginBase.php, line 212

Class

StylePluginBase
Base class for views style plugins.

Namespace

Drupal\views\Plugin\views\style

Code

public function getRowClass($row_index) {
  if ($this
    ->usesRowClass()) {
    $class = $this->options['row_class'];
    if ($this
      ->usesFields() && $this->view->field) {
      $class = strip_tags($this
        ->tokenizeValue($class, $row_index));
    }
    $classes = explode(' ', $class);
    foreach ($classes as &$class) {
      $class = Html::cleanCssIdentifier($class);
    }
    return implode(' ', $classes);
  }
}