function views_plugin_style::get_row_class

Same name in other branches
  1. 6.x-3.x plugins/views_plugin_style.inc \views_plugin_style::get_row_class()

Return the token replaced row class for the specified row.

File

plugins/views_plugin_style.inc, line 129

Class

views_plugin_style
Base class to define a style plugin handler.

Code

public function get_row_class($row_index) {
    if ($this->uses_row_class()) {
        $class = $this->options['row_class'];
        if ($this->uses_fields() && $this->view->field) {
            $classes = array();
            // Explode the value by whitespace, this allows the function to handle
            // a single class name and multiple class names that are then tokenized.
            foreach (explode(' ', $class) as $token_class) {
                $classes = array_merge($classes, explode(' ', strip_tags($this->tokenize_value($token_class, $row_index))));
            }
        }
        else {
            $classes = explode(' ', $class);
        }
        // Convert whatever the result is to a nice clean class name.
        foreach ($classes as &$class) {
            $class = drupal_clean_css_identifier($class);
        }
        unset($class);
        return implode(' ', $classes);
    }
}