From b158b24ab0bf4cd273d6e6d9aae7c63c38ca1531 Mon Sep 17 00:00:00 2001
From: Daniel Wehner <daniel.wehner@erdfisch.de>
Date: Sat, 28 Jul 2012 20:27:05 -0500
Subject: [PATCH] fix several different kind of unrelated things

---
 includes/admin.inc                            |  4 +-
 includes/cache.inc                            | 11 ++++
 .../Plugins/Discovery/ViewsDiscovery.php      | 64 ++++++++++---------
 .../Plugins/Type/AccessPluginManager.php      |  5 +-
 .../Type/ArgumentDefaultPluginManager.php     |  7 +-
 .../Type/ArgumentValidatorPluginManager.php   |  2 +-
 .../views/Plugins/Type/CachePluginManager.php |  2 +-
 .../Type/DisplayExtenderPluginManager.php     |  6 +-
 .../Plugins/Type/DisplayPluginManager.php     |  7 +-
 .../Plugins/Type/ExposedFormPluginManager.php |  5 +-
 .../Plugins/Type/HandlerPluginManager.php     |  6 +-
 .../Type/LocalizationPluginManager.php        |  5 +-
 .../views/Plugins/Type/PagerPluginManager.php |  5 +-
 .../views/Plugins/Type/QueryPluginManager.php |  4 +-
 .../views/Plugins/Type/RowPluginManager.php   |  4 +-
 .../views/Plugins/Type/StylePluginManager.php |  5 +-
 .../Plugins/Type/WizardPluginManager.php      |  4 +-
 .../Plugins/views/display/DefaultDisplay.php  |  2 +-
 .../views/display/DisplayPluginBase.php       |  4 +-
 views.module                                  | 19 +++---
 views_ui.module                               |  2 +-
 21 files changed, 94 insertions(+), 79 deletions(-)

diff --git a/includes/admin.inc b/includes/admin.inc
index 0c83614f5b9a..b3e68d6473ee 100644
--- a/includes/admin.inc
+++ b/includes/admin.inc
@@ -705,9 +705,9 @@ function views_ui_nojs_submit($form, &$form_state) {
  */
 function views_ui_wizard_form_validate($form, &$form_state) {
   $wizard = views_ui_get_wizard($form_state['values']['show']['wizard_key']);
-  $manager = new WizardManager();
+  $manager = views_get_plugin_manager('wizard');
   $form_state['wizard'] = $wizard;
-  $form_state['wizard_instance'] = $manager->createInstance($wizard['name']);
+  $form_state['wizard_instance'] = $manager->createInstance($wizard['plugin_id']);
   $errors = $form_state['wizard_instance']->validate($form, $form_state);
   foreach ($errors as $name => $message) {
     form_set_error($name, $message);
diff --git a/includes/cache.inc b/includes/cache.inc
index 60c242b3012f..f01bad040c79 100644
--- a/includes/cache.inc
+++ b/includes/cache.inc
@@ -88,6 +88,17 @@ function _views_data_process_entity_types(&$data) {
  */
 function _views_fetch_plugin_data($type = NULL, $plugin_id = NULL, $reset = FALSE) {
   $manager = views_get_plugin_manager($type);
+
+  if (!$type && !$plugin_id) {
+    $plugins = array();
+    $plugin_types = array('access', 'argument_default', 'argument_validator', 'cache', 'display_extender', 'display', 'exposed_form', 'localization', 'pager', 'query', 'row', 'style', 'wizard');
+    foreach ($plugin_types as $plugin_type) {
+      $manager = views_get_plugin_manager($plugin_type);
+      $plugins[$plugin_type] = $manager->getDefinitions();
+    }
+    return $plugins;
+  }
+
   if (!$plugin_id) {
     return $manager->getDefinitions();
   }
diff --git a/lib/Drupal/views/Plugins/Discovery/ViewsDiscovery.php b/lib/Drupal/views/Plugins/Discovery/ViewsDiscovery.php
index 214b41a0bf8d..4c41eeb353a3 100644
--- a/lib/Drupal/views/Plugins/Discovery/ViewsDiscovery.php
+++ b/lib/Drupal/views/Plugins/Discovery/ViewsDiscovery.php
@@ -6,42 +6,46 @@
  */
 
 namespace Drupal\views\Plugins\Discovery;
-use Drupal\Core\Plugin\Discovery\HookDiscovery;
+use Drupal\Core\Plugin\Discovery\AnnotatedClassDiscovery;
 
 /**
  * Discovery interface which supports the hook_views_plugins mechanism.
  */
-class ViewsDiscovery extends HookDiscovery {
-  /**
-   * The plugin type in views which should be discovered, for example query.
-   *
-   * @var string
-   */
-  protected $viewsPluginType;
+class ViewsDiscovery extends AnnotatedClassDiscovery {
+  public function getDefinitions() {
+    $definitions = parent::getDefinitions();
+    foreach ($definitions as $definition) {
+      // @todo: Allow other modules to write views plugins
+      $module_dir = $module = 'views';
+      // Setup automatic path/file finding for theme registration
+      if ($module_dir == 'views') {
+        $theme_path = drupal_get_path('module', $module_dir) . '/theme';
+        $theme_file = 'theme.inc';
+        $path = drupal_get_path('module', $module_dir) . '/plugins';
+      }
+      else {
+        $theme_path = $path = drupal_get_path('module', $module_dir);
+        $theme_file = "$module.views.inc";
+      }
 
-  /**
-   * Constructs a Drupal\views\Plugin\Discovery\ViewsDiscovery object.
-   *
-   * @param string $hook
-   *   The Drupal hook that a module can implement in order to interface to
-   *   this discovery class.
-   * @param string $plugin_type
-   *   The plugin type in views which should be discovered, for example query.
-   */
-  function __construct($hook, $plugin_type) {
-    $this->viewsPluginType = $plugin_type;
-    parent::__construct($hook);
-  }
+      $definition['module'] = $module_dir;
+      if (!isset($definition['theme path'])) {
+        $definition['theme path'] = $theme_path;
+      }
+      if (!isset($definition['theme file'])) {
+        $definition['theme file'] = $theme_file;
+      }
+      if (!isset($definition['path'])) {
+        $definition['path'] = $path;
+      }
+      if (!isset($definition['parent'])) {
+        $definition['parent'] = 'parent';
+      }
 
-  /**
-   * Implements Drupal\Component\Plugin\Discovery\DicoveryInterface::getDefinitions().
-   */
-  public function getDefinitions() {
-    views_include('plugins');
-    views_include_handlers();
+      // merge the new data in
+      $definitions[$definition['plugin_id']] = $definition;
+    }
 
-    $definitions = module_invoke_all($this->hook);
-    drupal_alter($this->hook, $definitions);
-    return $definitions[$this->viewsPluginType];
+    return $definitions;
   }
 }
diff --git a/lib/Drupal/views/Plugins/Type/AccessPluginManager.php b/lib/Drupal/views/Plugins/Type/AccessPluginManager.php
index 01f28ac5fe94..fb24fa40f188 100644
--- a/lib/Drupal/views/Plugins/Type/AccessPluginManager.php
+++ b/lib/Drupal/views/Plugins/Type/AccessPluginManager.php
@@ -10,11 +10,10 @@
 use Drupal\Component\Plugin\PluginManagerBase;
 use Drupal\Component\Plugin\Factory\DefaultFactory;
 use Drupal\views\Plugins\Discovery\ViewsDiscovery;
-use Drupal\Core\Plugin\Discovery\AnnotatedClassDiscovery;
 
 class AccessPluginManager extends PluginManagerBase {
   public function __construct() {
-    $this->discovery = new AnnotatedClassDiscovery('views', 'access');
-    $this->factory = new DefaultFactory($this);
+    $this->discovery = new ViewsDiscovery('views', 'access');
+    $this->factory = new DefaultFactory($this->discovery);
   }
 }
diff --git a/lib/Drupal/views/Plugins/Type/ArgumentDefaultPluginManager.php b/lib/Drupal/views/Plugins/Type/ArgumentDefaultPluginManager.php
index 2844a96fca5f..dcfa4ee1e4e1 100644
--- a/lib/Drupal/views/Plugins/Type/ArgumentDefaultPluginManager.php
+++ b/lib/Drupal/views/Plugins/Type/ArgumentDefaultPluginManager.php
@@ -9,11 +9,12 @@
 
 use Drupal\Component\Plugin\PluginManagerBase;
 use Drupal\Component\Plugin\Factory\DefaultFactory;
-use Drupal\views\Plugins\Discovery\ViewsDiscovery;
+use Drupal\Core\Plugin\Discovery\AnnotatedClassDiscovery;
+
 
 class ArgumentDefaultPluginManager extends PluginManagerBase {
   public function __construct() {
-    $this->discovery = new ViewsDiscovery('views_plugins', 'argument default');
-    $this->factory = new DefaultFactory($this);
+    $this->discovery = new AnnotatedClassDiscovery('views', 'argument_default');
+    $this->factory = new DefaultFactory($this->discovery);
   }
 }
diff --git a/lib/Drupal/views/Plugins/Type/ArgumentValidatorPluginManager.php b/lib/Drupal/views/Plugins/Type/ArgumentValidatorPluginManager.php
index bbad7df08707..149ec6643f63 100644
--- a/lib/Drupal/views/Plugins/Type/ArgumentValidatorPluginManager.php
+++ b/lib/Drupal/views/Plugins/Type/ArgumentValidatorPluginManager.php
@@ -15,6 +15,6 @@
 class ArgumentValidatorPluginManager extends PluginManagerBase {
   public function __construct() {
     $this->discovery = new AnnotatedClassDiscovery('views', 'argument_validator');
-    $this->factory = new DefaultFactory($this);
+    $this->factory = new DefaultFactory($this->discovery);
   }
 }
diff --git a/lib/Drupal/views/Plugins/Type/CachePluginManager.php b/lib/Drupal/views/Plugins/Type/CachePluginManager.php
index 03eeb38b83ef..cc98746a9adc 100644
--- a/lib/Drupal/views/Plugins/Type/CachePluginManager.php
+++ b/lib/Drupal/views/Plugins/Type/CachePluginManager.php
@@ -15,6 +15,6 @@
 class CachePluginManager extends PluginManagerBase {
   public function __construct() {
     $this->discovery = new AnnotatedClassDiscovery('views', 'cache');
-    $this->factory = new DefaultFactory($this);
+    $this->factory = new DefaultFactory($this->discovery);
   }
 }
diff --git a/lib/Drupal/views/Plugins/Type/DisplayExtenderPluginManager.php b/lib/Drupal/views/Plugins/Type/DisplayExtenderPluginManager.php
index 0b9fc1cb0211..4825c4972794 100644
--- a/lib/Drupal/views/Plugins/Type/DisplayExtenderPluginManager.php
+++ b/lib/Drupal/views/Plugins/Type/DisplayExtenderPluginManager.php
@@ -9,11 +9,11 @@
 
 use Drupal\Component\Plugin\PluginManagerBase;
 use Drupal\Component\Plugin\Factory\DefaultFactory;
-use Drupal\Core\Plugin\Discovery\AnnotatedClassDiscovery;
+use Drupal\Views\Plugins\Discovery\ViewsDiscovery;
 
 class DisplayExtenderPluginManager extends PluginManagerBase {
   public function __construct() {
-    $this->discovery = new AnnotatedClassDiscovery('views', 'display_extender');
-    $this->factory = new DefaultFactory($this);
+    $this->discovery = new ViewsDiscovery('views', 'display_extender');
+    $this->factory = new DefaultFactory($this->discovery);
   }
 }
diff --git a/lib/Drupal/views/Plugins/Type/DisplayPluginManager.php b/lib/Drupal/views/Plugins/Type/DisplayPluginManager.php
index efe69377f841..990ddee5358f 100644
--- a/lib/Drupal/views/Plugins/Type/DisplayPluginManager.php
+++ b/lib/Drupal/views/Plugins/Type/DisplayPluginManager.php
@@ -9,12 +9,11 @@
 
 use Drupal\Component\Plugin\PluginManagerBase;
 use Drupal\Component\Plugin\Factory\DefaultFactory;
-use Drupal\Core\Plugin\Discovery\AnnotatedClassDiscovery;
-
+use Drupal\views\Plugins\Discovery\ViewsDiscovery;
 
 class DisplayPluginManager extends PluginManagerBase {
   public function __construct() {
-    $this->discovery = new AnnotatedClassDiscovery('views', 'display');
-    $this->factory = new DefaultFactory($this);
+    $this->discovery = new ViewsDiscovery('views', 'display');
+    $this->factory = new DefaultFactory($this->discovery);
   }
 }
diff --git a/lib/Drupal/views/Plugins/Type/ExposedFormPluginManager.php b/lib/Drupal/views/Plugins/Type/ExposedFormPluginManager.php
index dae62b989292..f93c4ad216f4 100644
--- a/lib/Drupal/views/Plugins/Type/ExposedFormPluginManager.php
+++ b/lib/Drupal/views/Plugins/Type/ExposedFormPluginManager.php
@@ -9,12 +9,11 @@
 
 use Drupal\Component\Plugin\PluginManagerBase;
 use Drupal\Component\Plugin\Factory\DefaultFactory;
-use Drupal\Core\Plugin\Discovery\AnnotatedClassDiscovery;
-
+use Drupal\Views\Plugins\Discovery\ViewsDiscovery;
 
 class ExposedFormPluginManager extends PluginManagerBase {
   public function __construct() {
-    $this->discovery = new AnnotatedClassDiscovery('views', 'exposed_form');
+    $this->discovery = new ViewsDiscovery('views', 'exposed_form');
     $this->factory = new DefaultFactory($this);
   }
 }
diff --git a/lib/Drupal/views/Plugins/Type/HandlerPluginManager.php b/lib/Drupal/views/Plugins/Type/HandlerPluginManager.php
index 5335da81cdc3..836cf6af954e 100644
--- a/lib/Drupal/views/Plugins/Type/HandlerPluginManager.php
+++ b/lib/Drupal/views/Plugins/Type/HandlerPluginManager.php
@@ -9,7 +9,7 @@
 
 use Drupal\Component\Plugin\PluginManagerBase;
 use Drupal\Component\Plugin\Factory\DefaultFactory;
-use Drupal\Core\Plugin\Discovery\AnnotatedClassDiscovery;
+use Drupal\Views\Plugins\Discovery\ViewsDiscovery;
 
 class HandlerPluginManager extends PluginManagerBase {
   /**
@@ -22,9 +22,7 @@ class HandlerPluginManager extends PluginManagerBase {
   public function __construct($type) {
     $this->type = $type;
 
-    if (in_array($this->type, array('sort', 'filter', 'relationship', 'field', 'area', 'argument'))) {
-      $this->discovery = new AnnotatedClassDiscovery('views', $this->type);
-    }
+    $this->discovery = new ViewsDiscovery('views', $this->type);
     $this->factory = new DefaultFactory($this->discovery);
   }
 }
diff --git a/lib/Drupal/views/Plugins/Type/LocalizationPluginManager.php b/lib/Drupal/views/Plugins/Type/LocalizationPluginManager.php
index bed4066ece1b..a61f92b9b5f5 100644
--- a/lib/Drupal/views/Plugins/Type/LocalizationPluginManager.php
+++ b/lib/Drupal/views/Plugins/Type/LocalizationPluginManager.php
@@ -9,12 +9,11 @@
 
 use Drupal\Component\Plugin\PluginManagerBase;
 use Drupal\Component\Plugin\Factory\DefaultFactory;
-use Drupal\Core\Plugin\Discovery\AnnotatedClassDiscovery;
-
+use Drupal\Views\Plugins\Discovery\ViewsDiscovery;
 
 class LocalizationPluginManager extends PluginManagerBase {
   public function __construct() {
-    $this->discovery = new AnnotatedClassDiscovery('views', 'localization');
+    $this->discovery = new ViewsDiscovery('views', 'localization');
     $this->factory = new DefaultFactory($this);
   }
 }
diff --git a/lib/Drupal/views/Plugins/Type/PagerPluginManager.php b/lib/Drupal/views/Plugins/Type/PagerPluginManager.php
index a276f295b16b..9b7199ee0053 100644
--- a/lib/Drupal/views/Plugins/Type/PagerPluginManager.php
+++ b/lib/Drupal/views/Plugins/Type/PagerPluginManager.php
@@ -9,12 +9,11 @@
 
 use Drupal\Component\Plugin\PluginManagerBase;
 use Drupal\Component\Plugin\Factory\DefaultFactory;
-use Drupal\Core\Plugin\Discovery\AnnotatedClassDiscovery;
-
+use Drupal\Views\Plugins\Discovery\ViewsDiscovery;
 
 class PagerPluginManager extends PluginManagerBase {
   public function __construct() {
-    $this->discovery = new AnnotatedClassDiscovery('views', 'pager');
+    $this->discovery = new ViewsDiscovery('views', 'pager');
     $this->factory = new DefaultFactory($this);
   }
 }
diff --git a/lib/Drupal/views/Plugins/Type/QueryPluginManager.php b/lib/Drupal/views/Plugins/Type/QueryPluginManager.php
index 52b1e93a5c91..473fe408bc06 100644
--- a/lib/Drupal/views/Plugins/Type/QueryPluginManager.php
+++ b/lib/Drupal/views/Plugins/Type/QueryPluginManager.php
@@ -9,11 +9,11 @@
 
 use Drupal\Component\Plugin\PluginManagerBase;
 use Drupal\Component\Plugin\Factory\DefaultFactory;
-use Drupal\Core\Plugin\Discovery\AnnotatedClassDiscovery;
+use Drupal\Views\Plugins\Discovery\ViewsDiscovery;
 
 class QueryPluginManager extends PluginManagerBase {
   public function __construct() {
-    $this->discovery = new AnnotatedClassDiscovery('views', 'query');
+    $this->discovery = new ViewsDiscovery('views', 'query');
     $this->factory = new DefaultFactory($this);
   }
 }
diff --git a/lib/Drupal/views/Plugins/Type/RowPluginManager.php b/lib/Drupal/views/Plugins/Type/RowPluginManager.php
index 2b66cb3e75e2..488ac6388d0f 100644
--- a/lib/Drupal/views/Plugins/Type/RowPluginManager.php
+++ b/lib/Drupal/views/Plugins/Type/RowPluginManager.php
@@ -9,11 +9,11 @@
 
 use Drupal\Component\Plugin\PluginManagerBase;
 use Drupal\Component\Plugin\Factory\DefaultFactory;
-use Drupal\Core\Plugin\Discovery\AnnotatedClassDiscovery;
+use Drupal\Views\Plugins\Discovery\ViewsDiscovery;
 
 class RowPluginManager extends PluginManagerBase {
   public function __construct() {
-    $this->discovery = new AnnotatedClassDiscovery('views', 'row');
+    $this->discovery = new ViewsDiscovery('views', 'row');
     $this->factory = new DefaultFactory($this);
   }
 }
diff --git a/lib/Drupal/views/Plugins/Type/StylePluginManager.php b/lib/Drupal/views/Plugins/Type/StylePluginManager.php
index a61b3e3d0a79..1aa53fabf0b9 100644
--- a/lib/Drupal/views/Plugins/Type/StylePluginManager.php
+++ b/lib/Drupal/views/Plugins/Type/StylePluginManager.php
@@ -9,11 +9,12 @@
 
 use Drupal\Component\Plugin\PluginManagerBase;
 use Drupal\Component\Plugin\Factory\DefaultFactory;
-use Drupal\Core\Plugin\Discovery\AnnotatedClassDiscovery;
+use Drupal\Views\Plugins\Discovery\ViewsDiscovery;
+
 
 class StylePluginManager extends PluginManagerBase {
   public function __construct() {
-    $this->discovery = new AnnotatedClassDiscovery('views', 'style');
+    $this->discovery = new ViewsDiscovery('views', 'style');
     $this->factory = new DefaultFactory($this);
   }
 }
diff --git a/lib/Drupal/views/Plugins/Type/WizardPluginManager.php b/lib/Drupal/views/Plugins/Type/WizardPluginManager.php
index f480331fdf13..092e96862ac7 100644
--- a/lib/Drupal/views/Plugins/Type/WizardPluginManager.php
+++ b/lib/Drupal/views/Plugins/Type/WizardPluginManager.php
@@ -9,11 +9,11 @@
 
 use Drupal\Component\Plugin\PluginManagerBase;
 use Drupal\Component\Plugin\Factory\DefaultFactory;
-use Drupal\Core\Plugin\Discovery\AnnotatedClassDiscovery;
+use Drupal\Views\Plugins\Discovery\ViewsDiscovery;
 
 class WizardPluginManager extends PluginManagerBase {
   public function __construct() {
-    $this->discovery = new AnnotatedClassDiscovery('views', 'wizard');
+    $this->discovery = new ViewsDiscovery('views', 'wizard');
     $this->factory = new DefaultFactory($this->discovery);
   }
 }
diff --git a/lib/Drupal/views/Plugins/views/display/DefaultDisplay.php b/lib/Drupal/views/Plugins/views/display/DefaultDisplay.php
index fda0af931d7b..8015bde999be 100644
--- a/lib/Drupal/views/Plugins/views/display/DefaultDisplay.php
+++ b/lib/Drupal/views/Plugins/views/display/DefaultDisplay.php
@@ -18,7 +18,7 @@
 
 /**
  * @Plugin(
- *   plugin_id = "standard",
+ *   plugin_id = "default",
  *   title = @Translation("Master"),
  *   help = @Translation("Default settings for this view."),
  *   theme = "views_view",
diff --git a/lib/Drupal/views/Plugins/views/display/DisplayPluginBase.php b/lib/Drupal/views/Plugins/views/display/DisplayPluginBase.php
index 17850f715b90..7e9579914cb3 100644
--- a/lib/Drupal/views/Plugins/views/display/DisplayPluginBase.php
+++ b/lib/Drupal/views/Plugins/views/display/DisplayPluginBase.php
@@ -83,6 +83,7 @@ function init(&$view, &$display, $options = NULL) {
       unset($options['defaults']);
     }
 
+    views_include('cache');
     // Cache for unpack_options, but not if we are in the ui.
     static $unpack_options = array();
     if (empty($view->editing)) {
@@ -1212,7 +1213,8 @@ function options_summary(&$categories, &$options) {
     }
 
     if (!empty($style_plugin['uses_row_plugin'])) {
-      $row_plugin = views_fetch_plugin_data('row', $this->get_option('row_plugin'));
+      $manager = views_get_plugin_manager('row');
+      $row_plugin = $manager->getDefinition($this->get_option('row_plugin'));
       $row_plugin_instance = $this->get_plugin('row');
       $row_summary = empty($row_plugin['title']) ? t('Missing style plugin') : $row_plugin_instance->summary_title();
       $row_title = empty($row_plugin['title']) ? t('Missing style plugin') : $row_plugin_instance->plugin_title();
diff --git a/views.module b/views.module
index 25ee4b18dea4..d46165d4878e 100644
--- a/views.module
+++ b/views.module
@@ -884,12 +884,17 @@ function views_add_contextual_links(&$render_element, $location, $view, $display
     // If contextual_links_locations are not set, provide a sane default. (To
     // avoid displaying any contextual links at all, a display plugin can still
     // set 'contextual_links_locations' to, e.g., {""}.)
-    if (!(isset($plugin['contextual_links_locations']) && $plugin['contextual_links_locations'] = array(""))) {
-      $plugin += array('contextual_links_locations' => array('view'));
+
+    if (!isset($plugin['contextual_links_locations'])) {
+      $plugin['contextual_links_locations'] = array('view');
     }
-    else {
+    elseif ($plugin['contextual_links_locations'] = array() || $plugin['contextual_links_locations'] == array('')) {
       $plugin['contextual_links_locations'] = array();
     }
+    else {
+      $plugin += array('contextual_links_locations' => array('view'));
+    }
+
     // On exposed_forms blocks contextual links should always be visible.
     $plugin['contextual_links_locations'][] = 'special_block_-exp';
     $has_links = !empty($plugin['contextual links']) && !empty($plugin['contextual_links_locations']);
@@ -1345,9 +1350,6 @@ function views_fetch_plugin_names($type, $key = NULL, $base = array()) {
   foreach ($definitions as $plugin_id => $plugin) {
     if (empty($plugin['no ui']) && (empty($base) || empty($plugin['base']) || array_intersect($base, $plugin['base']))) {
       $plugins[$plugin_id] = $plugin['title'];
-      if (!isset($plugin['title'])) {
-        dsm($plugin);
-      }
     }
   }
 
@@ -1355,6 +1357,7 @@ function views_fetch_plugin_names($type, $key = NULL, $base = array()) {
     asort($plugins);
     return $plugins;
   }
+
   // fall-through
   return array();
 }
@@ -1400,10 +1403,10 @@ function views_get_plugin_manager($type) {
     case 'row':
       $manager = new RowPluginManager();
       break;
-    case 'argument default':
+    case 'argument_default':
       $manager = new ArgumentDefaultPluginManager();
       break;
-    case 'argument validator':
+    case 'argument_validator':
       $manager = new ArgumentValidatorPluginManager();
       break;
     case 'access':
diff --git a/views_ui.module b/views_ui.module
index f271818e4910..bbc31e0f784e 100644
--- a/views_ui.module
+++ b/views_ui.module
@@ -551,7 +551,7 @@ function views_ui_ctools_plugin_directory($module, $plugin) {
  */
 function views_ui_get_wizard($wizard_type) {
   ctools_include('plugins');
-  $manager = new WizardManager();
+  $manager = views_get_plugin_manager('wizard');
   $wizard = $manager->getDefinition($wizard_type);
   // @todo - handle this via an alter hook instead.
   if (!$wizard) {
-- 
GitLab