In #361756: Updating views fields changes field alias names, merlinofchaos explained that the proper way to print out views values into a .tpl.php is through the $rows / $fields variable (whichever is applicable for that template). So for most operations this becomes:
if ($rows[$row_id]['field_id'] == 'bananas') {
// ... stuff...
}
However, when you want to take a peek at a hidden field, you need to resort to this:
if ($view->field['field_id']->render($view->result[$row_id]) == 'bananas') {
// ... stuff...
}
It'd be nice if there was something that was easier to grok that could be used consistently across all fields, regardless of whether they were visible in the output or not. Merlin suggested the following as a syntax:
if ($view->render_field('field_id', $row_id) == 'bananas') {
// ... stuff...
}
Sounds good to me!
Comments
Comment #1
merlinofchaos commentedas part of the generic link patch I added:
$view->render_field('field_id', $row_number);
Comment #2
merlinofchaos commented