diff --git a/core/modules/views/src/Plugin/ViewsHandlerManager.php b/core/modules/views/src/Plugin/ViewsHandlerManager.php index bfc859227a184a62545d4ab75ed1e55706f05fd5..f94ff5173ea70c481a59cb332376f7d6a479e5a4 100644 --- a/core/modules/views/src/Plugin/ViewsHandlerManager.php +++ b/core/modules/views/src/Plugin/ViewsHandlerManager.php @@ -82,7 +82,7 @@ public function getHandler($item, $override = NULL) { $table = $item['table']; $field = $item['field']; // Get the plugin manager for this type. - $data = $this->viewsData->get($table); + $data = $table ? $this->viewsData->get($table) : $this->viewsData->getAll(); if (isset($data[$field][$this->handlerType])) { $definition = $data[$field][$this->handlerType]; diff --git a/core/modules/views/src/ViewsData.php b/core/modules/views/src/ViewsData.php index 09522b984f5a6fc22a242bcaf89c05bb6e2bd64a..9552ffddc13cfe153716323515bd671c88f643ac 100644 --- a/core/modules/views/src/ViewsData.php +++ b/core/modules/views/src/ViewsData.php @@ -137,12 +137,14 @@ public function getAll() { * removed in 9.0.0. Use getAll() instead. * * @see https://www.drupal.org/node/2723553 + * @see https://www.drupal.org/node/3090442 * * @return array * An array of table data. */ public function get($key = NULL) { if (!$key) { + @trigger_error('Calling get() without the $key argument is deprecated in drupal:8.2.0 and is required in drupal:9.0.0. See https://www.drupal.org/node/3090442', E_USER_DEPRECATED); return $this->getAll(); } if (!isset($this->storage[$key])) { @@ -297,7 +299,7 @@ protected function processEntityTypes(array &$data) { public function fetchBaseTables() { $tables = []; - foreach ($this->get() as $table => $info) { + foreach ($this->getAll() as $table => $info) { if (!empty($info['table']['base'])) { $tables[$table] = [ 'title' => $info['table']['base']['title'], diff --git a/core/modules/views/src/ViewsDataHelper.php b/core/modules/views/src/ViewsDataHelper.php index 6a9188bee6813bdebf323d46ba6c3cea7cfde9d8..da4f7f1c3b57380b90a3a545e10e545322f4fe3e 100644 --- a/core/modules/views/src/ViewsDataHelper.php +++ b/core/modules/views/src/ViewsDataHelper.php @@ -51,7 +51,7 @@ public function __construct(ViewsData $views_data) { */ public function fetchFields($base, $type, $grouping = FALSE, $sub_type = NULL) { if (!$this->fields) { - $data = $this->data->get(); + $data = $this->data->getAll(); // This constructs this ginormous multi dimensional array to // collect the important data about fields. In the end, // the structure looks a bit like this (using nid as an example) diff --git a/core/modules/views/tests/src/Functional/Handler/HandlerAllTest.php b/core/modules/views/tests/src/Functional/Handler/HandlerAllTest.php index 3c3ed24e2acfc0f88c89c17c8ed10485c0929817..e08f01d67543688a9724ff908aa932ad7ee1ac5a 100644 --- a/core/modules/views/tests/src/Functional/Handler/HandlerAllTest.php +++ b/core/modules/views/tests/src/Functional/Handler/HandlerAllTest.php @@ -52,7 +52,7 @@ public function testHandlers() { $this->addDefaultCommentField('node', 'article'); $object_types = array_keys(ViewExecutable::getHandlerTypes()); - foreach ($this->container->get('views.views_data')->get() as $base_table => $info) { + foreach ($this->container->get('views.views_data')->getAll() as $base_table => $info) { if (!isset($info['table']['base'])) { continue; } diff --git a/core/modules/views/tests/src/Unit/ViewsDataHelperTest.php b/core/modules/views/tests/src/Unit/ViewsDataHelperTest.php index b08938c234e0723916b5fcfe54816f6b1d810933..6dbfd3c94ddae45eed73b78753c5c83ba0e28afe 100644 --- a/core/modules/views/tests/src/Unit/ViewsDataHelperTest.php +++ b/core/modules/views/tests/src/Unit/ViewsDataHelperTest.php @@ -43,7 +43,7 @@ public function testFetchFields() { ->disableOriginalConstructor() ->getMock(); $views_data->expects($this->once()) - ->method('get') + ->method('getAll') ->will($this->returnValue($this->viewsData())); $data_helper = new ViewsDataHelper($views_data); diff --git a/core/modules/views/tests/src/Unit/ViewsDataTest.php b/core/modules/views/tests/src/Unit/ViewsDataTest.php index 4d0b6766b4a231b5e712c310fcd6a93c02e3da0d..cd718c759f3c62a3a502e48434f44763edbc2825 100644 --- a/core/modules/views/tests/src/Unit/ViewsDataTest.php +++ b/core/modules/views/tests/src/Unit/ViewsDataTest.php @@ -642,6 +642,9 @@ public function testCacheCallsWithoutWarmCacheAndGetMultipleTables() { * logic. * * @covers ::getAll + * @group legacy + * + * @expectedDeprecation Calling get() without the $key argument is deprecated in drupal:8.2.0 and is required in drupal:9.0.0. See https://www.drupal.org/node/3090442 */ public function testGetAllEqualsToGetNull() { $expected_views_data = $this->viewsDataWithProvider();