function StylePluginBase::getRowClass

Same name in other branches
  1. 9 core/modules/views/src/Plugin/views/style/StylePluginBase.php \Drupal\views\Plugin\views\style\StylePluginBase::getRowClass()
  2. 10 core/modules/views/src/Plugin/views/style/StylePluginBase.php \Drupal\views\Plugin\views\style\StylePluginBase::getRowClass()
  3. 11.x 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);
    }
}

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