views_table_highlighter.module in Views Table Highlighter 6
File
views_table_highlighter.module
View source
<?php
function views_table_highlighter_init() {
drupal_add_css(drupal_get_path('module', 'views_table_highlighter') . '/views_table_highlighter.css');
}
function views_table_highlighter_views_api() {
return array(
'api' => 2.0,
);
}
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}";
}
}
}
}