From a0030289d8827d9e4d5ad8a95edd8161994298c1 Mon Sep 17 00:00:00 2001 From: Alex Pott Date: Wed, 19 Jun 2013 22:10:25 +0200 Subject: [PATCH] Issue #1907902 by dawehner, damiankloip: Move views_get_handler() into the handler plugin manager. --- .../views/Plugin/ViewsHandlerManager.php | 96 ++++++++++++++++++- .../Drupal/views/Plugin/views/HandlerBase.php | 2 +- .../views/display/DisplayPluginBase.php | 2 +- .../views/exposed_form/InputRequired.php | 3 +- .../views/Plugin/views/row/RowPluginBase.php | 2 +- .../Plugin/views/sort/GroupByNumeric.php | 3 +- .../views/Tests/Handler/FieldUnitTest.php | 6 +- .../views/Tests/Handler/HandlerAllTest.php | 2 +- .../views/Tests/Handler/HandlerTest.php | 4 +- .../lib/Drupal/views/Tests/ModuleTest.php | 15 ++- core/modules/views/lib/Drupal/views/Views.php | 9 ++ core/modules/views/views.module | 67 ------------- core/modules/views/views.services.yml | 14 +-- .../Drupal/views_ui/Form/Ajax/ConfigItem.php | 4 +- .../views_ui/Form/Ajax/ConfigItemGroup.php | 3 +- .../views_ui/lib/Drupal/views_ui/ViewUI.php | 2 +- 16 files changed, 133 insertions(+), 101 deletions(-) diff --git a/core/modules/views/lib/Drupal/views/Plugin/ViewsHandlerManager.php b/core/modules/views/lib/Drupal/views/Plugin/ViewsHandlerManager.php index 7e154ce600c..4ac2fac2442 100644 --- a/core/modules/views/lib/Drupal/views/Plugin/ViewsHandlerManager.php +++ b/core/modules/views/lib/Drupal/views/Plugin/ViewsHandlerManager.php @@ -7,30 +7,118 @@ namespace Drupal\views\Plugin; +use Drupal\Component\Plugin\Exception\PluginException; use Drupal\Component\Plugin\PluginManagerBase; use Drupal\Core\Plugin\Factory\ContainerFactory; use Drupal\Core\Plugin\Discovery\CacheDecorator; use Drupal\views\Plugin\Discovery\ViewsHandlerDiscovery; +use Drupal\views\ViewsData; /** * Plugin type manager for all views handlers. */ class ViewsHandlerManager extends PluginManagerBase { + /** + * The views data cache. + * + * @var \Drupal\views\ViewsData + */ + protected $viewsData; + + /** + * The handler type. + * + * @var string + * + * @see \Drupal\views\ViewExecutable::viewsHandlerTypes(). + */ + protected $handlerType; + /** * Constructs a ViewsHandlerManager object. * - * @param string $type + * @param string $handler_type * The plugin type, for example filter. * @param \Traversable $namespaces * An object that implements \Traversable which contains the root paths * keyed by the corresponding namespace to look for plugin implementations, + * @param \Drupal\views\ViewsData $views_data + * The views data cache. */ - public function __construct($type, \Traversable $namespaces) { - $this->discovery = new ViewsHandlerDiscovery($type, $namespaces); - $this->discovery = new CacheDecorator($this->discovery, "views:$type", 'views_info'); + public function __construct($handler_type, \Traversable $namespaces, ViewsData $views_data) { + $this->discovery = new ViewsHandlerDiscovery($handler_type, $namespaces); + $this->discovery = new CacheDecorator($this->discovery, "views:$handler_type", 'views_info'); $this->factory = new ContainerFactory($this); + + $this->viewsData = $views_data; + $this->handlerType = $handler_type; + } + + + /** + * Fetches a handler from the data cache. + * + * @param array $item + * An associative array representing the handler to be retrieved: + * - table: The name of the table containing the handler. + * - field: The name of the field the handler represents. + * - optional: (optional) Whether or not this handler is optional. If a + * handler is missing and not optional, a debug message will be displayed. + * Defaults to FALSE. + * @param string|null $override + * (optional) Override the actual handler object with this plugin ID. Used for + * aggregation when the handler is redirected to the aggregation handler. + * + * @return \Drupal\views\Plugin\views\HandlerBase + * An instance of a handler object. May be a broken handler instance. + */ + public function getHandler($item, $override = NULL) { + $table = $item['table']; + $field = $item['field']; + $optional = isset($item['optional']) ? $item['optional'] : FALSE; + // Get the plugin manager for this type. + $data = $this->viewsData->get($table); + + if (isset($data[$field][$this->handlerType])) { + $definition = $data[$field][$this->handlerType]; + foreach (array('group', 'title', 'title short', 'help', 'real field', 'real table') as $key) { + if (!isset($definition[$key])) { + // First check the field level. + if (!empty($data[$field][$key])) { + $definition[$key] = $data[$field][$key]; + } + // Then if that doesn't work, check the table level. + elseif (!empty($data['table'][$key])) { + $definition[$key] = $data['table'][$key]; + } + } + } + + // @todo This is crazy. Find a way to remove the override functionality. + $plugin_id = $override ? : $definition['id']; + // Try to use the overridden handler. + try { + return $this->createInstance($plugin_id, $definition); + } + catch (PluginException $e) { + // If that fails, use the original handler. + try { + return $this->createInstance($definition['id'], $definition); + } + catch (PluginException $e) { + // Deliberately empty, this case is handled generically below. + } + } + } + + if (!$optional) { + // debug(t("Missing handler: @table @field @type", array('@table' => $table, '@field' => $field, '@type' => $this->handlerType))); + } + + // Finally, use the 'broken' handler. + return $this->createInstance('broken'); } } diff --git a/core/modules/views/lib/Drupal/views/Plugin/views/HandlerBase.php b/core/modules/views/lib/Drupal/views/Plugin/views/HandlerBase.php index b026438f9b9..b07d763b18f 100644 --- a/core/modules/views/lib/Drupal/views/Plugin/views/HandlerBase.php +++ b/core/modules/views/lib/Drupal/views/Plugin/views/HandlerBase.php @@ -875,7 +875,7 @@ abstract class HandlerBase extends PluginBase { // Create a new handler and unpack the options from the form onto it. We // can use that for storage. - $handler = views_get_handler($item, $handler_type, $override); + $handler = Views::handlerManager($handler_type)->getHandler($item, $override); $handler->init($executable, $executable->display_handler, $item); // Add the incoming options to existing options because items using diff --git a/core/modules/views/lib/Drupal/views/Plugin/views/display/DisplayPluginBase.php b/core/modules/views/lib/Drupal/views/Plugin/views/display/DisplayPluginBase.php index 16aa2f402f1..4d13ee86583 100644 --- a/core/modules/views/lib/Drupal/views/Plugin/views/display/DisplayPluginBase.php +++ b/core/modules/views/lib/Drupal/views/Plugin/views/display/DisplayPluginBase.php @@ -898,7 +898,7 @@ abstract class DisplayPluginBase extends PluginBase { $handler_type = $type; } - if ($handler = views_get_handler($info, $handler_type, $override)) { + if ($handler = Views::handlerManager($handler_type)->getHandler($info, $override)) { // Special override for area types so they know where they come from. if ($handler instanceof AreaPluginBase) { $handler->areaType = $type; diff --git a/core/modules/views/lib/Drupal/views/Plugin/views/exposed_form/InputRequired.php b/core/modules/views/lib/Drupal/views/Plugin/views/exposed_form/InputRequired.php index 38eebeeb873..5a946749071 100644 --- a/core/modules/views/lib/Drupal/views/Plugin/views/exposed_form/InputRequired.php +++ b/core/modules/views/lib/Drupal/views/Plugin/views/exposed_form/InputRequired.php @@ -9,6 +9,7 @@ namespace Drupal\views\Plugin\views\exposed_form; use Drupal\Component\Annotation\Plugin; use Drupal\Core\Annotation\Translation; +use Drupal\views\Views; /** * Exposed form plugin that provides an exposed form with required input. @@ -83,7 +84,7 @@ class InputRequired extends ExposedFormPluginBase { 'content' => $this->options['text_input_required'], 'format' => $this->options['text_input_required_format'], ); - $handler = views_get_handler($options, 'area'); + $handler = Views::handlerManager('area')->getHandler($options); $handler->init($this->view, $options); $this->displayHandler->handlers['empty'] = array( 'area' => $handler, diff --git a/core/modules/views/lib/Drupal/views/Plugin/views/row/RowPluginBase.php b/core/modules/views/lib/Drupal/views/Plugin/views/row/RowPluginBase.php index 44df69f0b6a..4a22155fc87 100644 --- a/core/modules/views/lib/Drupal/views/Plugin/views/row/RowPluginBase.php +++ b/core/modules/views/lib/Drupal/views/Plugin/views/row/RowPluginBase.php @@ -71,7 +71,7 @@ abstract class RowPluginBase extends PluginBase { $relationship_options = array(); foreach ($relationships as $relationship) { - $relationship_handler = views_get_handler($relationship, 'relationship'); + $relationship_handler = Views::handlerManager('relationship')->getHandler($relationship); // If this relationship is valid for this type, add it to the list. $data = Views::viewsData()->get($relationship['table']); diff --git a/core/modules/views/lib/Drupal/views/Plugin/views/sort/GroupByNumeric.php b/core/modules/views/lib/Drupal/views/Plugin/views/sort/GroupByNumeric.php index 20cf966fd51..1c528c8a34e 100644 --- a/core/modules/views/lib/Drupal/views/Plugin/views/sort/GroupByNumeric.php +++ b/core/modules/views/lib/Drupal/views/Plugin/views/sort/GroupByNumeric.php @@ -10,6 +10,7 @@ namespace Drupal\views\Plugin\views\sort; use Drupal\Component\Annotation\PluginID; use Drupal\views\Plugin\views\display\DisplayPluginBase; use Drupal\views\ViewExecutable; +use Drupal\views\Views; /** * Handler for GROUP BY on simple numeric fields. @@ -25,7 +26,7 @@ class GroupByNumeric extends SortPluginBase { parent::init($view, $display, $options); // Initialize the original handler. - $this->handler = views_get_handler($options, 'sort'); + $this->handler = Views::handlerManager('sort')->getHandler($options); $this->handler->init($view, $display, $options); } diff --git a/core/modules/views/lib/Drupal/views/Tests/Handler/FieldUnitTest.php b/core/modules/views/lib/Drupal/views/Tests/Handler/FieldUnitTest.php index 14e919701d5..2c90c37d14b 100644 --- a/core/modules/views/lib/Drupal/views/Tests/Handler/FieldUnitTest.php +++ b/core/modules/views/lib/Drupal/views/Tests/Handler/FieldUnitTest.php @@ -529,17 +529,17 @@ class FieldUnitTest extends ViewUnitTestBase { 'table' => 'views_test_data', 'field' => 'name', ); - $plugin = views_get_handler($item, 'field'); + $plugin = $this->container->get('plugin.manager.views.field')->getHandler($item); $this->assertTrue($plugin->clickSortable(), 'TRUE as a default value is correct.'); // Test that clickSortable is TRUE by when set TRUE in the data. $item['field'] = 'id'; - $plugin = views_get_handler($item, 'field'); + $plugin = $this->container->get('plugin.manager.views.field')->getHandler($item); $this->assertTrue($plugin->clickSortable(), 'TRUE as a views data value is correct.'); // Test that clickSortable is FALSE by when set FALSE in the data. $item['field'] = 'job'; - $plugin = views_get_handler($item, 'field'); + $plugin = $this->container->get('plugin.manager.views.field')->getHandler($item); $this->assertFalse($plugin->clickSortable(), 'FALSE as a views data value is correct.'); } diff --git a/core/modules/views/lib/Drupal/views/Tests/Handler/HandlerAllTest.php b/core/modules/views/lib/Drupal/views/Tests/Handler/HandlerAllTest.php index 78e768c4959..c28ce3779a6 100644 --- a/core/modules/views/lib/Drupal/views/Tests/Handler/HandlerAllTest.php +++ b/core/modules/views/lib/Drupal/views/Tests/Handler/HandlerAllTest.php @@ -80,7 +80,7 @@ class HandlerAllTest extends HandlerTestBase { if (isset($field_info[$type]['id'])) { $options = array(); if ($type == 'filter') { - $handler = views_get_handler($item, $type); + $handler = $this->container->get("plugin.manager.views.$type")->getHandler($item); if ($handler instanceof InOperator) { $options['value'] = array(1); } diff --git a/core/modules/views/lib/Drupal/views/Tests/Handler/HandlerTest.php b/core/modules/views/lib/Drupal/views/Tests/Handler/HandlerTest.php index 05b3665be15..5e152969dc2 100644 --- a/core/modules/views/lib/Drupal/views/Tests/Handler/HandlerTest.php +++ b/core/modules/views/lib/Drupal/views/Tests/Handler/HandlerTest.php @@ -105,7 +105,7 @@ class HandlerTest extends ViewTestBase { 'table' => 'node', 'field' => 'title', ); - $handler = views_get_handler($item, 'argument'); + $handler = $this->container->get('plugin.manager.views.argument')->getHandler($item); $this->assertEqual($handler, HandlerBase::breakPhraseString('', $handler), 'The breakPhraseString() method works correctly.'); // test ors @@ -164,7 +164,7 @@ class HandlerTest extends ViewTestBase { 'table' => 'node', 'field' => 'title', ); - $handler = views_get_handler($item, 'argument'); + $handler = $this->container->get('plugin.manager.views.argument')->getHandler($item); $this->assertEqual($handler, HandlerBase::breakPhrase('', $handler), 'The breakPhrase() method works correctly.'); // Generate three random numbers which can be used below; diff --git a/core/modules/views/lib/Drupal/views/Tests/ModuleTest.php b/core/modules/views/lib/Drupal/views/Tests/ModuleTest.php index b58f4886e4e..103571fde03 100644 --- a/core/modules/views/lib/Drupal/views/Tests/ModuleTest.php +++ b/core/modules/views/lib/Drupal/views/Tests/ModuleTest.php @@ -51,7 +51,7 @@ class ModuleTest extends ViewUnitTestBase { 'table' => $this->randomName(), 'field' => $this->randomName(), ); - $handler = views_get_handler($item, $type); + $handler = Views::handlerManager($type)->getHandler($item); $this->assertEqual('Drupal\views\Plugin\views\\' . $type . '\Broken', get_class($handler), t('Make sure that a broken handler of type: @type are created', array('@type' => $type))); } @@ -66,7 +66,7 @@ class ModuleTest extends ViewUnitTestBase { ); foreach ($data as $id => $field_data) { if (!in_array($id, array('title', 'help'))) { - $handler = views_get_handler($item, $id); + $handler = Views::handlerManager($id)->getHandler($item); $this->assertInstanceHandler($handler, $table, $field, $id); } } @@ -78,7 +78,7 @@ class ModuleTest extends ViewUnitTestBase { 'table' => 'views_test_data', 'field' => 'job', ); - $handler = views_get_handler($item, 'filter', 'standard'); + $handler = Views::handlerManager('filter')->getHandler($item, 'standard'); $this->assertTrue($handler instanceof Standard); // @todo Reinstate these tests when the debug() in views_get_handler() is @@ -91,7 +91,7 @@ class ModuleTest extends ViewUnitTestBase { 'table' => 'views_test_data', 'field' => 'field_invalid', ); - views_get_handler($item, 'field'); + Views::handlerManager('field')->getHandler($item); $this->assertTrue(strpos($this->lastErrorMessage, format_string("Missing handler: @table @field @type", array('@table' => 'views_test_data', '@field' => 'field_invalid', '@type' => 'field'))) !== FALSE, 'An invalid field name throws a debug message.'); unset($this->lastErrorMessage); @@ -99,7 +99,7 @@ class ModuleTest extends ViewUnitTestBase { 'table' => 'table_invalid', 'field' => 'id', ); - views_get_handler($item, 'filter'); + Views::handlerManager('filter')->getHandler($item); $this->assertEqual(strpos($this->lastErrorMessage, format_string("Missing handler: @table @field @type", array('@table' => 'table_invalid', '@field' => 'id', '@type' => 'filter'))) !== FALSE, 'An invalid table name throws a debug message.'); unset($this->lastErrorMessage); @@ -108,7 +108,7 @@ class ModuleTest extends ViewUnitTestBase { 'field' => 'id', 'optional' => FALSE, ); - views_get_handler($item, 'filter'); + Views::handlerManager('filter')->getHandler($item); $this->assertEqual(strpos($this->lastErrorMessage, format_string("Missing handler: @table @field @type", array('@table' => 'table_invalid', '@field' => 'id', '@type' => 'filter'))) !== FALSE, 'An invalid table name throws a debug message.'); unset($this->lastErrorMessage); @@ -117,8 +117,7 @@ class ModuleTest extends ViewUnitTestBase { 'field' => 'id', 'optional' => TRUE, ); - - views_get_handler($item, 'filter'); + Views::handlerManager('filter')->getHandler($item); $this->assertFalse($this->lastErrorMessage, "An optional handler does not throw a debug message."); unset($this->lastErrorMessage); diff --git a/core/modules/views/lib/Drupal/views/Views.php b/core/modules/views/lib/Drupal/views/Views.php index 9af207c31bd..3c45ab3a5c1 100644 --- a/core/modules/views/lib/Drupal/views/Views.php +++ b/core/modules/views/lib/Drupal/views/Views.php @@ -56,4 +56,13 @@ class Views { return Drupal::service('plugin.manager.views.' . $type); } + /** + * Returns the plugin manager for a certain views handler type. + * + * @return \Drupal\views\Plugin\ViewsHandlerManager + */ + public static function handlerManager($type) { + return Drupal::service('plugin.manager.views.' . $type); + } + } diff --git a/core/modules/views/views.module b/core/modules/views/views.module index 0bf5687a79c..c7077e93c0d 100644 --- a/core/modules/views/views.module +++ b/core/modules/views/views.module @@ -831,73 +831,6 @@ function views_library_info() { return $libraries; } -/** - * Fetch a handler from the data cache. - * - * @param array $item - * An associative array representing the handler to be retrieved: - * - table: The name of the table containing the handler. - * - field: The name of the field the handler represents. - * - optional: (optional) Whether or not this handler is optional. If a - * handler is missing and not optional, a debug message will be displayed. - * Defaults to FALSE. - * @param string $type - * The type of handler. i.e, sort, field, argument, filter, relationship - * @param string|null $override - * (optional) Override the actual handler object with this plugin ID. Used for - * aggregation when the handler is redirected to the aggregation handler. - * - * @return views_handler - * An instance of a handler object. May be views_handler_broken. - */ -function views_get_handler($item, $type, $override = NULL) { - $table = $item['table']; - $field = $item['field']; - $optional = isset($item['optional']) ? $item['optional'] : FALSE; - // Get the plugin manager for this type. - $manager = Views::pluginManager($type); - $data = Views::viewsData()->get($table); - - if (isset($data[$field][$type])) { - $definition = $data[$field][$type]; - foreach (array('group', 'title', 'title short', 'help', 'real field', 'real table') as $key) { - if (!isset($definition[$key])) { - // First check the field level - if (!empty($data[$field][$key])) { - $definition[$key] = $data[$field][$key]; - } - // Then if that doesn't work, check the table level - elseif (!empty($data['table'][$key])) { - $definition[$key] = $data['table'][$key]; - } - } - } - - // @todo This is crazy. Find a way to remove the override functionality. - $plugin_id = $override ?: $definition['id']; - // Try to use the overridden handler. - try { - return $manager->createInstance($plugin_id, $definition); - } - catch (PluginException $e) { - // If that fails, use the original handler. - try { - return $manager->createInstance($definition['id'], $definition); - } - catch (PluginException $e) { - // Deliberately empty, this case is handled generically below. - } - } - } - - if (!$optional) { - //debug(t("Missing handler: @table @field @type", array('@table' => $table, '@field' => $field, '@type' => $type))); - } - - // Finally, use the 'broken' handler. - return $manager->createInstance('broken'); -} - /** * Fetch a list of all base tables available * diff --git a/core/modules/views/views.services.yml b/core/modules/views/views.services.yml index 1629da5e9a7..93abaabf429 100644 --- a/core/modules/views/views.services.yml +++ b/core/modules/views/views.services.yml @@ -4,10 +4,10 @@ services: arguments: [access, '@container.namespaces'] plugin.manager.views.area: class: Drupal\views\Plugin\ViewsHandlerManager - arguments: [area, '@container.namespaces'] + arguments: [area, '@container.namespaces', '@views.views_data'] plugin.manager.views.argument: class: Drupal\views\Plugin\ViewsHandlerManager - arguments: [argument, '@container.namespaces'] + arguments: [argument, '@container.namespaces', '@views.views_data'] plugin.manager.views.argument_default: class: Drupal\views\Plugin\ViewsPluginManager arguments: [argument_default, '@container.namespaces'] @@ -28,13 +28,13 @@ services: arguments: [exposed_form, '@container.namespaces'] plugin.manager.views.field: class: Drupal\views\Plugin\ViewsHandlerManager - arguments: [field, '@container.namespaces'] + arguments: [field, '@container.namespaces', '@views.views_data'] plugin.manager.views.filter: class: Drupal\views\Plugin\ViewsHandlerManager - arguments: [filter, '@container.namespaces'] + arguments: [filter, '@container.namespaces', '@views.views_data'] plugin.manager.views.join: class: Drupal\views\Plugin\ViewsHandlerManager - arguments: [join, '@container.namespaces'] + arguments: [join, '@container.namespaces', '@views.views_data'] plugin.manager.views.pager: class: Drupal\views\Plugin\ViewsPluginManager arguments: [pager, '@container.namespaces'] @@ -43,13 +43,13 @@ services: arguments: [query, '@container.namespaces'] plugin.manager.views.relationship: class: Drupal\views\Plugin\ViewsHandlerManager - arguments: [relationship, '@container.namespaces'] + arguments: [relationship, '@container.namespaces', '@views.views_data'] plugin.manager.views.row: class: Drupal\views\Plugin\ViewsPluginManager arguments: [row, '@container.namespaces'] plugin.manager.views.sort: class: Drupal\views\Plugin\ViewsHandlerManager - arguments: [sort, '@container.namespaces'] + arguments: [sort, '@container.namespaces', '@views.views_data'] plugin.manager.views.style: class: Drupal\views\Plugin\ViewsPluginManager arguments: [style, '@container.namespaces'] diff --git a/core/modules/views_ui/lib/Drupal/views_ui/Form/Ajax/ConfigItem.php b/core/modules/views_ui/lib/Drupal/views_ui/Form/Ajax/ConfigItem.php index b0475074b21..a82a5d826cc 100644 --- a/core/modules/views_ui/lib/Drupal/views_ui/Form/Ajax/ConfigItem.php +++ b/core/modules/views_ui/lib/Drupal/views_ui/Form/Ajax/ConfigItem.php @@ -96,7 +96,7 @@ class ConfigItem extends ViewsFormBase { if ($type == 'relationship' && $id == $relationship['id']) { break; } - $relationship_handler = views_get_handler($relationship, 'relationship'); + $relationship_handler = Views::handlerManager('relationship')->getHandler($relationship); // ignore invalid/broken relationships. if (empty($relationship_handler)) { continue; @@ -225,7 +225,7 @@ class ConfigItem extends ViewsFormBase { // Create a new handler and unpack the options from the form onto it. We // can use that for storage. - $handler = views_get_handler($item, $handler_type, $override); + $handler = Views::handlerManager($handler_type)->getHandler($item, $override); $handler->init($executable, $executable->display_handler, $item); // Add the incoming options to existing options because items using diff --git a/core/modules/views_ui/lib/Drupal/views_ui/Form/Ajax/ConfigItemGroup.php b/core/modules/views_ui/lib/Drupal/views_ui/Form/Ajax/ConfigItemGroup.php index 8f2da4660bd..4df211beefe 100644 --- a/core/modules/views_ui/lib/Drupal/views_ui/Form/Ajax/ConfigItemGroup.php +++ b/core/modules/views_ui/lib/Drupal/views_ui/Form/Ajax/ConfigItemGroup.php @@ -7,6 +7,7 @@ namespace Drupal\views_ui\Form\Ajax; +use Drupal\views\Views; use Drupal\views\ViewStorageInterface; use Drupal\views\ViewExecutable; @@ -99,7 +100,7 @@ class ConfigItemGroup extends ViewsFormBase { $type = $form_state['type']; $id = $form_state['id']; - $handler = views_get_handler($item, $type); + $handler = Views::handlerManager($type)->getHandler($item); $executable = $form_state['view']->get('executable'); $handler->init($executable, $executable->display_handler, $item); diff --git a/core/modules/views_ui/lib/Drupal/views_ui/ViewUI.php b/core/modules/views_ui/lib/Drupal/views_ui/ViewUI.php index 85020de36d3..c83e5f7cf97 100644 --- a/core/modules/views_ui/lib/Drupal/views_ui/ViewUI.php +++ b/core/modules/views_ui/lib/Drupal/views_ui/ViewUI.php @@ -469,7 +469,7 @@ class ViewUI implements ViewStorageInterface { 'table' => $table, 'field' => $field, ); - $handler = views_get_handler($item, $key); + $handler = Views::handlerManager($key)->getHandler($item); if ($this->executable->displayHandlers->get('default')->useGroupBy() && $handler->usesGroupBy()) { $this->addFormToStack('config-item-group', $form_state['display_id'], $type, $id); }