Closed (fixed)
Project:
Views (for Drupal 7)
Version:
7.x-3.x-dev
Component:
Code
Priority:
Normal
Category:
Bug report
Assigned:
Unassigned
Reporter:
Created:
19 Apr 2011 at 00:53 UTC
Updated:
15 Jun 2011 at 19:51 UTC
At line 957 in the current 7.x-dev the display handler output is used before it is set.
// Let the theme play too, because pre render is a very themey thing.
$function = $GLOBALS['theme'] . '_views_pre_render';
if (function_exists($function)) {
$function($this, $this->display_handler->output, $cache); <--USED HERE
}
// Give field handlers the opportunity to perform additional queries
// using the entire resultset prior to rendering.
if ($this->style_plugin->uses_fields()) {
foreach ($this->field as $id => $handler) {
if (!empty($this->field[$id])) {
$this->field[$id]->pre_render($this->result);
}
}
}
$this->display_handler->output = $this->display_handler->render(); <--SET HERE
When a theme_views_pre_render() function is used the following error is generated:
Notice: Undefined property: views_plugin_display_page::$output in view->render() (line 861 of /var/www/html/sites/all/modules/contrib/views/includes/view.inc).
Potential fix is to not attempt to pass the unrendered output. Patch below fixes issue.
| Comment | File | Size | Author |
|---|---|---|---|
| undef-output-1.patch | 545 bytes | 13rac1 |
Comments
Comment #1
dawehnerMakes sense, because the hook itself has the same signature.
Comment #2
dawehnerBut how do we care that nothhing is broken with this.
Comment #3
Agence Web CoherActio commentedHi,
Changing
function hook_views_pre_render(&$view) {into
function hook_views_pre_render(&$view, &$output, &$cache) {worked for me
Regards
Laurent
Comment #4
Agence Web CoherActio commentedAs a follow up to my previous post: my suggested workaround only works for module hooks but not with theme overrides.
Laurent
Comment #5
merlinofchaos commentedThis is clearly a bad cut & paste job causing it; the variables at that point don't exist. Those are used in post_render only. Committed to all branches.