I want to change the color of the node titles from a view (fields on table). My first ides was to alter the title and add a span with inline css.
function views_titles_views_pre_render(&$view) {
if ($view->name == 'documents' && $view->current_display == 'page') {
$span_open = '<span style="color: green !important;">';
$span_close = '</span>';
$view->style_plugin->render_fields($view->result);
foreach ($view->style_plugin->rendered_fields as $index => &$rendered_result) {
// Add HTML markup icon on rendered title field
$rendered_result['title'] = $span_open . $rendered_result['title'].$span_close;
}
}
}
Although my attempt was a success, I managed to alter the title the css rule did not alter the color of the a tag. I figured out that I should go deeper into the title. As far I can tel the dpm of the views_pre_render does not show more options.
I have experience with drupal site building, but I am not in any way a php developer.
Can someone help me figure this out?
ps: I know there other more easy ways to achieve that but I want to do it with a module.