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.

CommentFileSizeAuthor
undef-output-1.patch545 bytes13rac1

Comments

dawehner’s picture

Makes sense, because the hook itself has the same signature.

dawehner’s picture

But how do we care that nothhing is broken with this.

Agence Web CoherActio’s picture

Hi,

Changing
function hook_views_pre_render(&$view) {
into
function hook_views_pre_render(&$view, &$output, &$cache) {

worked for me

Regards

Laurent

Agence Web CoherActio’s picture

As a follow up to my previous post: my suggested workaround only works for module hooks but not with theme overrides.
Laurent

merlinofchaos’s picture

Status: Needs review » Fixed

This 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.

Status: Fixed » Closed (fixed)

Automatically closed -- issue fixed for 2 weeks with no activity.