You are here

function views_table_highlighter_preprocess in Views Table Highlighter 7

Same name and namespace in other branches
  1. 6 views_table_highlighter.module \views_table_highlighter_preprocess()

Implements hook_preprocess().

File

./views_table_highlighter.module, line 40

Code

function views_table_highlighter_preprocess(&$variables, $hook) {
  if ($hook === 'views_view_table' && isset($variables['view']->style_plugin->options['views_table_highlighter'])) {
    foreach ($variables['view']->result as $i => $fieldset) {
      $GLOBALS['views_table_highlighter_fieldset'] = _views_table_highlighter_cook_fields((array) $fieldset);
      $color = php_eval('<?php extract($GLOBALS["views_table_highlighter_fieldset"]); ' . $variables['view']->style_options['views_table_highlighter']['code']);
      if ($color) {
        $variables['row_classes'][$i][] = "views-table-highlighter-{$color}";
      }
    }
  }
}