diff --git a/core/modules/views/lib/Drupal/views/Plugin/Type/PluginManager.php b/core/modules/views/lib/Drupal/views/Plugin/Type/PluginManager.php index 997be69..89c32d3 100644 --- a/core/modules/views/lib/Drupal/views/Plugin/Type/PluginManager.php +++ b/core/modules/views/lib/Drupal/views/Plugin/Type/PluginManager.php @@ -25,6 +25,7 @@ public function __construct($type) { 'parent' => 'parent', 'plugin_type' => $type, 'module' => 'views', + 'register_theme' => TRUE, ); } diff --git a/core/modules/views/views.module b/core/modules/views/views.module index 91aa4d7..f18a8fe 100644 --- a/core/modules/views/views.module +++ b/core/modules/views/views.module @@ -137,31 +137,41 @@ function views_theme($existing, $type, $theme, $path) { // Register theme functions for all style plugins foreach ($plugins as $type => $info) { foreach ($info as $plugin => $def) { - if (isset($def['theme'])) { + // Not all plugins have theme functions, and they can also explicitly + // prevent a theme function from being registered automatically. + if (!isset($def['theme']) || empty($def['register_theme'])) { + continue; + } + $hooks[$def['theme']] = array( 'pattern' => $def['theme'] . '__', 'variables' => $variables[$type], ); + if ($def['module'] == 'views') { $def['theme_file'] = 'views.theme.inc'; } - if (isset($def['theme_file'])) { - $hook[$def['theme']]['file'] = $def['theme_file']; + elseif (isset($def['theme_file'])) { + $def['theme_path'] = drupal_get_path('module', $def['module']); } + if (isset($def['theme_path'])) { - $hook[$def['theme']]['path'] = $def['theme_path']; - $include = DRUPAL_ROOT . '/' . $def['theme_path'] . '/' . $theme_file; + $hooks[$def['theme']]['path'] = $def['theme_path']; + } + if (isset($def['theme_file'])) { + $hooks[$def['theme']]['file'] = $def['theme_file']; + } + if (isset($def['theme_path']) && isset($def['theme_file'])) { + $include = DRUPAL_ROOT . '/' . $def['theme_path'] . '/' . $def['theme_file']; if (is_file($include)) { require_once $include; } } - if (!function_exists('theme_' . $def['theme'])) { $hooks[$def['theme']]['template'] = drupal_clean_css_identifier($def['theme']); } } } - } $hooks['views_form_views_form'] = $base + array( 'render element' => 'form',