You are here

function views_table_highlighter_preprocess in Views Table Highlighter 6

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

Implements hook_preprocess().

File

./views_table_highlighter.module, line 22

Code

function views_table_highlighter_preprocess(&$variables, $hook) {
  if (substr($hook, 0, strlen('views_view_table')) === 'views_view_table' && isset($variables['view']->style_plugin->options['views_table_highlighter'])) {
    foreach ($variables['view']->result as $i => $fieldset) {
      $GLOBALS['views_table_highlighter_fieldset'] = (array) $fieldset;
      $color = drupal_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}";
      }
    }
  }
}