Accessing all VIEW data in a preprocess hook I have the following hook method:

hook_preprocess_views_view_unformatted(&amp;$vars)


I can obtain the VIEW like so:

$view = $vars['view'];


When I dump this result I can see a complex structure with all the data I need...the VIEW can be iterated via:

foreach ($view-&gt;result as $index =&gt; $record) 


Each records data (node details) is navigable via the following path:

$record-&gt;_field_data['nid']['entity']-&gt;field_XXX


I am uneasy accessing these details with the second property in this chain as usually "underscore" represents private...maybe it is just the OO purist in mean telling me it's bad practice and I am defeating OCP. :)

Ultimately I need the ability to iterate my custom fields and this seems to be the only way I can achieve that -- is there not a API which would encapsulate this access for me? 

I assumed the $view object itself would have an API to provide traversing methods or at least result iteration, but it doesn't appear that way.
The result array in the Views object contains the row information so yes, if you need to access the results, this is the way to do it.

For example, including:

function YOURMODULE_preprocess_views_view(&amp;$variables) {

  $view=$variables['view'];
  drupal_set_message('&lt;pre&gt;' . print_r($view-&gt;result, TRUE) . '&lt;/pre&gt;');

}


and then a quick View that just returns node objects would look like this:



and a View that returns fields (in this case just titles) would look like this:



and then when you actually include custom fields, you get that big _field_data array, eg:




but you should also see it in a more top level area of the results as well:



Also, a quick look at views_get_view_result() might shed some more "this is how we do it" confirmation/information on Views results.  Also What is the hook to preprocess a view and Changing values in preprocess view function talk about other options available to you in the Views API.