hook_views_post_render does not play nicely with base themes in Views versions 7.x-3.x.

I'm seeing the following error message:

Warning: Missing argument 2 for THEME_views_post_render(), called in PATH/modules/views/includes/view.inc on line 1287 and defined in THEME_views_post_render() (line 247 of PATH/themes/custom/THEME/template.php).

The problem appears to lie within includes/view.inc, where:

    foreach ($GLOBALS['base_theme_info'] as $base) {
      $function = $base->name . '_views_post_render';
      if (function_exists($function)) {
        $function($this);
      }
    }
    $function = $GLOBALS['theme'] . '_views_post_render';
    if (function_exists($function)) {
      $function($this, $this->display_handler->output, $cache);
    }

This should presumably be:

    foreach ($GLOBALS['base_theme_info'] as $base) {
      $function = $base->name . '_views_post_render';
      if (function_exists($function)) {
        $function($this, $this->display_handler->output, $cache);
      }
    }
    $function = $GLOBALS['theme'] . '_views_post_render';
    if (function_exists($function)) {
      $function($this, $this->display_handler->output, $cache);
    }

Comments

tom.gillett’s picture

Patch attached.

mrdalesmith’s picture

Patch confirmed as working.

mrdalesmith’s picture

Status: Needs review » Reviewed & tested by the community
damienmckenna’s picture

I looked this over, it seems correct. I'm also not concerned about the D8 aspects because theming in D8 is very different to D7.

damienmckenna’s picture

Status: Reviewed & tested by the community » Fixed

Committed. Thanks!

Status: Fixed » Closed (fixed)

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