Views - Test if field is visible via PHP I am developing a custom theme for a specific view. I need to iterate and render each row and field, How can i do that?

Some code:

foreach($view-&gt;rows as idx =&gt; $row)
{
    foreach($view-&gt;field as $name =&gt; $handler)
    {
        //I need to check if the field is hidden from
        //display here
        $view-&gt;render_field($name, idx);
    }
}


I am going through with the debugger and use $handler array options, but within that I could not find any field that is visible or not.

Can anybody help?
Data that you are looking for is located at $field-&gt;handler-&gt;options['exclude']. But it is tricky to get to.

When you mark the field as excluded, its data becomes inaccessible at the field's level in your View's template.

$row object also does not have any indication that the field was excluded via Views UI. $row contains only the value data from each field. You can confirm that by doing dsm($row); in your View template file (if you have devel module installed).

If you are overriding you View's template on the "Row style output" level, than the only object you can use to reach options['exclude'] from already excluded fields is $views.  

You could do something like this at the top of your .tpl file:

foreach ($view-&gt;field as $view_field)
    {
        //check if field is excluded
         if ($view_field-&gt;options['exclude'] == 1) {
             // field is exluded - do something
             print $view_field-&gt;field.' is excluded from this view'; // print name of excluded field 
             print $row-&gt;field_field_yourfieldname[0]['raw']['safe_value'];
        }
    }


so, if the field is excluded - it is going to be excluded in each row, according to that you can assign some markup or text to a variable and then print it anywhere down the template.