Quantcast
Channel: Issues for Drupal core
Viewing all articles
Browse latest Browse all 299521

hook_views_pre_render is broken if your theme implements a base theme

$
0
0

We introduced a bug in #1895266: Convert views to use the ModuleHandler

// Let the themes play too, because pre render is a very themey thing.
       foreach ($GLOBALS['base_theme_info'] as $base) {
-        $function = $base->name . '_views_pre_render';
-        if (function_exists($function)) {
-          $function($this);
-        }
-      }
-      $function = $GLOBALS['theme'] . '_views_pre_render';
-      if (function_exists($function)) {
-        $function($this);
+        $module_handler->invoke($base, 'views_pre_render', array($this));
       }

     // Let the themes play too, because post render is a very themey thing.
     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);
+      $module_handler->invoke($base, 'views_post_render', array($this));
     }

Both hunks assume the ModuleHandler::invoke can accept an object as the first argument but it can't... the original code that did $base->name was correct.

  /**
   * Invokes a hook in a particular module.
   *
   * @param string $module
   *   The name of the module (without the .module extension).
   * @param string $hook
   *   The name of the hook to invoke.
   * @param ...
   *   Arguments to pass to the hook implementation.
   *
   * @return mixed
   *   The return value of the hook implementation.
   */
  public function invoke($module, $hook, $args = array());

Viewing all articles
Browse latest Browse all 299521

Latest Images

Trending Articles



Latest Images