0

I have a view of teasers, and would like to check the status of each node. Using hook_views_pre_render (in the template.php file of the theme), I can access:

$view->style_plugin->row_plugin

Which gives me the output below (only first few lines printed, using debug):

entity_views_plugin_row_entity_view::__set_state(array(
 'entity_type' => 'node',
 'entities' => 
 array (
  0 => 
  stdClass::__set_state(array(
     'vid' => '19',
     'uid' => '1',
     'title' => 'My Node Title',
     'log' => '',
     'status' => '0',
     'comment' => '1',
     'promote' => '0',

However, I can't figure out how to access the status variable.

debug($view->style_plugin->row_plugin->entities());

produces a white screen, any variation that I tried either returned NULL or a white screen.

Any help greatly appreciated.

  • row_plugin appears to be an array, not an object. Have you tried $view->style_plugin->row_plugin['entities']? – rabyrd2 Sep 17 '14 at 19:31
0

Install the Devel module if you haven't already and use dpm($view); to see the structure of the view, then you can drill down to the part of the variable that you wish to inspect.

The devel module will print the result of your dpm() in the message area as long as there are no syntax errors in your module crashing the site.

I have found drush cc all (Linux command line tool) to be useful in finding syntax errors though I suspect there is a better way.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.