diff -u b/includes/admin.inc b/includes/admin.inc --- b/includes/admin.inc +++ b/includes/admin.inc @@ -311,7 +311,8 @@ * Validate the add view form. */ function views_ui_wizard_form_validate($form, &$form_state) { - $wizard = views_ui_get_wizard($form_state['values']['show']['wizard_key']); + $wizard_type = $form_state['values']['show']['wizard_key']; + $wizard = drupal_container()->get('plugin.manager.views.wizard')->getDefinition($wizard_type); $form_state['wizard'] = $wizard; $form_state['wizard_instance'] = views_get_plugin('wizard', $wizard['id']); $errors = $form_state['wizard_instance']->validateView($form, $form_state); @@ -327,7 +328,7 @@ // Create the "Show" dropdown, which allows the base table of the view to be // selected. - $wizard_plugins = drupal_container()->get('plugin.manager.views.wizard')->getDefinitions(); + $wizard_plugins = views_ui_get_wizards(); $options = array(); foreach ($wizard_plugins as $key => $wizard) { $options[$key] = $wizard['title']; @@ -654,8 +655,7 @@ * Validate the add view form. */ function views_ui_wizard_form_validate($form, &$form_state) { - $wizard_type = $form_state['values']['show']['wizard_key']; - $wizard = drupal_container()->get('plugin.manager.views.wizard')->getDefinition($wizard_type); + $wizard = views_ui_get_wizard($form_state['values']['show']['wizard_key']); $form_state['wizard'] = $wizard; $form_state['wizard_instance'] = views_get_plugin('wizard', $wizard['id']); $errors = $form_state['wizard_instance']->validateView($form, $form_state); @@ -2868,45 +2868,6 @@ // ------------------------------------------------------------------ // Get information from the Views data -function _views_weight_sort($a, $b) { - if ($a['weight'] != $b['weight']) { - return $a['weight'] < $b['weight'] ? -1 : 1; - } - if ($a['title'] != $b['title']) { - return $a['title'] < $b['title'] ? -1 : 1; - } - - return 0; -} - -/** - * Fetch a list of all base tables available - * - * @return - * A keyed array of in the form of 'base_table' => 'Description'. - */ -function views_fetch_base_tables() { - static $base_tables = array(); - if (empty($base_tables)) { - $weights = array(); - $tables = array(); - $data = views_fetch_data(); - foreach ($data as $table => $info) { - if (!empty($info['table']['base'])) { - $tables[$table] = array( - 'title' => $info['table']['base']['title'], - 'description' => !empty($info['table']['base']['help']) ? $info['table']['base']['help'] : '', - 'weight' => !empty($info['table']['base']['weight']) ? $info['table']['base']['weight'] : 0, - ); - } - } - uasort($tables, '_views_weight_sort'); - $base_tables = $tables; - } - - return $base_tables; -} - function _views_sort_types($a, $b) { $a_group = drupal_strtolower($a['group']); $b_group = drupal_strtolower($b['group']); reverted: --- b/lib/Drupal/views/Plugin/Type/ViewsPluginManager.php +++ a/lib/Drupal/views/Plugin/Type/ViewsPluginManager.php @@ -25,7 +25,7 @@ // @todo Remove this hack in http://drupal.org/node/1708404. views_init(); + $this->discovery = new CacheDecorator(new AnnotatedClassDiscovery('views', $type), 'views:' . $type, 'views'); - $this->discovery = new CacheDecorator(new AnnotatedClassDiscovery('views', $type), 'views:' . $type, 'views_info'); $this->factory = new DefaultFactory($this); $this->coreModules = views_core_modules(); $this->defaults += array( reverted: --- b/lib/Drupal/views/Plugin/Type/ViewsWizardPluginManager.php +++ /dev/null @@ -1,25 +0,0 @@ -discovery = new CacheDecorator(new WizardDiscovery('views', $type), 'views:' . $type, 'views_info'); - } - -} diff -u b/lib/Drupal/views/ViewStorage.php b/lib/Drupal/views/ViewStorage.php --- b/lib/Drupal/views/ViewStorage.php +++ b/lib/Drupal/views/ViewStorage.php @@ -240,7 +240,7 @@ return FALSE; } - $plugin = drupal_container()->get('plugin.manager.views.display')->getDefinition($plugin_id); + $plugin = views_get_plugin_definition('display', $plugin_id); if (empty($plugin)) { $plugin['title'] = t('Broken'); } @@ -259,7 +259,7 @@ return FALSE; } - $plugin = views_get_plugin_definition('display', $plugin_id); + $plugin = drupal_container()->get('plugin.manager.views.display')->getDefinition($plugin_id); if (empty($plugin)) { $plugin['title'] = t('Broken'); } reverted: --- b/lib/Drupal/views/ViewsBundle.php +++ a/lib/Drupal/views/ViewsBundle.php @@ -21,14 +21,8 @@ */ public function build(ContainerBuilder $container) { foreach (ViewExecutable::getPluginTypes() as $type) { + $container->register("plugin.manager.views.$type", 'Drupal\views\Plugin\Type\ViewsPluginManager') + ->addArgument($type); - if ($type == 'wizard') { - $container->register("plugin.manager.views.wizard", 'Drupal\views\Plugin\Type\ViewsWizardPluginManager') - ->addArgument($type); - } - else { - $container->register("plugin.manager.views.$type", 'Drupal\views\Plugin\Type\ViewsPluginManager') - ->addArgument($type); - } } } diff -u b/views.module b/views.module --- b/views.module +++ b/views.module @@ -1370,6 +1370,45 @@ return _views_fetch_data($table, $move, $reset); } +/** + * Fetch a list of all base tables available + * + * @return array + * A keyed array of in the form of 'base_table' => 'Description'. + */ +function views_fetch_base_tables() { + static $base_tables = array(); + if (empty($base_tables)) { + $weights = array(); + $tables = array(); + $data = views_fetch_data(); + foreach ($data as $table => $info) { + if (!empty($info['table']['base'])) { + $tables[$table] = array( + 'title' => $info['table']['base']['title'], + 'description' => !empty($info['table']['base']['help']) ? $info['table']['base']['help'] : '', + 'weight' => !empty($info['table']['base']['weight']) ? $info['table']['base']['weight'] : 0, + ); + } + } + uasort($tables, '_views_weight_sort'); + $base_tables = $tables; + } + + return $base_tables; +} + +function _views_weight_sort($a, $b) { + if ($a['weight'] != $b['weight']) { + return $a['weight'] < $b['weight'] ? -1 : 1; + } + if ($a['title'] != $b['title']) { + return $a['title'] < $b['title'] ? -1 : 1; + } + + return 0; +} + // ----------------------------------------------------------------------- // Views plugin functions only in patch2: unchanged: --- a/lib/Drupal/views/Plugin/Type/WizardManager.php +++ b/lib/Drupal/views/Plugin/Type/WizardManager.php @@ -28,7 +28,8 @@ class WizardManager extends PluginManagerBase { // @todo Remove this hack in http://drupal.org/node/1708404. views_init(); - $this->discovery = new CacheDecorator(new AnnotatedClassDiscovery('views', 'wizard'), 'views:wizard', 'views_info'); + $this->discovery = new CacheDecorator(new WizardDiscovery('views', 'wizard'), 'views:wizard', 'views_info'); + $this->factory = new DefaultFactory($this); $this->coreModules = views_core_modules();