From 587f8d24d2dce7f729a6024be95a5a9fa33cc4e9 Mon Sep 17 00:00:00 2001 From: Tim Plunkett <git@plnktt.com> Date: Mon, 13 Aug 2012 20:15:48 -0400 Subject: [PATCH] Allow plugins to specify a module, and check for module_exists(). --- lib/Drupal/views/Plugin/Discovery/ViewsDiscovery.php | 4 +++- views.module | 5 +++++ 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/lib/Drupal/views/Plugin/Discovery/ViewsDiscovery.php b/lib/Drupal/views/Plugin/Discovery/ViewsDiscovery.php index 7a97616080c9..fda051c4b27f 100644 --- a/lib/Drupal/views/Plugin/Discovery/ViewsDiscovery.php +++ b/lib/Drupal/views/Plugin/Discovery/ViewsDiscovery.php @@ -29,7 +29,9 @@ public function getDefinitions() { $theme_file = "$module.views.inc"; } - $definition['module'] = $module_dir; + if (!isset($definition['module'])) { + $definition['module'] = $module_dir; + } if (!isset($definition['theme path'])) { $definition['theme path'] = $theme_path; } diff --git a/views.module b/views.module index 508578e0eb56..baf67a4f1753 100644 --- a/views.module +++ b/views.module @@ -1336,6 +1336,11 @@ function views_fetch_plugin_names($type, $key = NULL, $base = array()) { if ($key && (empty($plugin['type']) || $plugin['type'] != $key)) { continue; } + // @todo While Views is providing on behalf of core modules, check to see + // if they are enabled or not. + if (isset($plugin['module']) && !module_exists($plugin['module'])) { + continue; + } if (empty($plugin['no ui']) && (empty($base) || empty($plugin['base']) || array_intersect($base, $plugin['base']))) { $plugins[$id] = $plugin['title']; -- GitLab