I need to debug the $result
property of the ViewExecutable
object passed to hook_views_post_execute
but for what ever reason, Drupal can't handle it. $view->result is an array of type ResultRow
, and because it's an array, I'm attempting to log it like so:
\Drupal::logger('foo')->notice('<pre>' . print_r($view->result, TRUE) . '</pre>');
When I do this and then load the view I'm attempting to mess with, it loads the page without css and then the recent log messages just shows up blank, no errors or anything that would actually be helpful.
I've tried a number of different ways but this is always the result. Why can't this logger print a simple array?
I've even tried looping through the array and printing just the value:
foreach($view->result as $key => $value) {
\Drupal::logger('bar')->notice(print_r($value, true));
}
And that will render the view without css and then the logger doesn't print anything at all. I double checked and printed a regular string and that worked, but when I attempt to print the value it just breaks and doesn't do anything.
dpm($view->result)
or when you also have Kint installedksm($view->result)
to pretty-print variables into the Status Messages block.