I think it totally makes sense to replace views_get_handler() by a method on the plugin manager, which then can get the views data injected properly.

Support from Acquia helps fund testing for Drupal Acquia logo

Comments

dawehner’s picture

Status: Active » Needs review
FileSize
21.22 KB

Let's see whether this passes all tests.

Status: Needs review » Needs work
Issue tags: -VDC

The last submitted patch, drupal-1907902-1.patch, failed testing.

dawehner’s picture

Status: Needs work » Needs review

#1: drupal-1907902-1.patch queued for re-testing.

Status: Needs review » Needs work
Issue tags: +VDC

The last submitted patch, drupal-1907902-1.patch, failed testing.

dawehner’s picture

Status: Needs work » Needs review
FileSize
21.44 KB

Fixed some bugs, though there is a single problem: The DefaultFactory puts the discovery method into the plugin, so it is not serializeable anymore, just because we now store the viewsDataCache in there.

Status: Needs review » Needs work

The last submitted patch, drupal-1907902-5.patch, failed testing.

dawehner’s picture

Status: Needs work » Needs review
FileSize
907 bytes

So the problem is that now the form state contains a db connection, as plugins stores it's manager which gets the views data cache with this patch.

One idea was to use the ViewStorage in the views form (see attached patch), though this does not help, as we need to executed view in order to construct the form.

dawehner’s picture

FileSize
7.85 KB

.

dawehner’s picture

FileSize
14.9 KB

Let's do it.

Status: Needs review » Needs work

The last submitted patch, drupal-1907902-9.patch, failed testing.

dawehner’s picture

Status: Needs work » Needs review
FileSize
638 bytes
15.09 KB

Forgot to include joins

Status: Needs review » Needs work

The last submitted patch, drupal-1907902-11.patch, failed testing.

dawehner’s picture

Status: Needs work » Needs review
FileSize
17.5 KB

Rerolled.

Status: Needs review » Needs work
Issue tags: -VDC

The last submitted patch, drupal-1907902-13.patch, failed testing.

dawehner’s picture

Status: Needs work » Needs review
Issue tags: +VDC

#13: drupal-1907902-13.patch queued for re-testing.

damiankloip’s picture

Status: Needs review » Needs work
+++ b/core/modules/views/lib/Drupal/views/Plugin/ViewsHandlerManager.phpundefined
@@ -18,6 +20,22 @@
    * @param string $type

@@ -25,12 +43,80 @@ class ViewsHandlerManager extends PluginManagerBase {
+  public function __construct($type, \Traversable $namespaces, ViewsData $views_data) {

I think we should call this $handler_type

+++ b/core/modules/views/lib/Drupal/views/Plugin/ViewsHandlerManager.phpundefined
@@ -25,12 +43,80 @@ class ViewsHandlerManager extends PluginManagerBase {
+   * Fetch a handler from the data cache.

Fetches/Gets

+++ b/core/modules/views/lib/Drupal/views/Plugin/ViewsHandlerManager.phpundefined
@@ -25,12 +43,80 @@ class ViewsHandlerManager extends PluginManagerBase {
+          // First check the field level
...
+          // Then if that doesn't work, check the table level

nitpcik alert: full stops...

+++ b/core/modules/views/lib/Drupal/views/Plugin/ViewsHandlerManager.phpundefined
@@ -25,12 +43,80 @@ class ViewsHandlerManager extends PluginManagerBase {
+      // @todo This is crazy. Find a way to remove the override functionality.
+      $plugin_id = $override ?: $definition['id'];

Are we actually using this anywhere atm?

+++ b/core/modules/views/lib/Drupal/views/Tests/ModuleTest.phpundefined
@@ -78,7 +78,7 @@ public function testViewsGetHandler() {
+    $handler = Views::handlerManager('filter')->getHandler($item, 'standard');

Much nicer :)

+++ b/core/modules/views/views.moduleundefined
@@ -828,55 +828,11 @@ function views_library_info() {
 function views_get_handler($item, $type, $override = NULL) {

Didn't you replace all the calls to this in the patch anyway?

dawehner’s picture

Status: Needs work » Needs review
FileSize
24.47 KB

Are we actually using this anywhere atm?

Yes we do for groupby handlers.

Didn't you replace all the calls to this in the patch anyway?

No all are converted.

dawehner’s picture

Issue tags: -VDC

#17: drupal-1907902-17.patch queued for re-testing.

Status: Needs review » Needs work
Issue tags: +VDC

The last submitted patch, drupal-1907902-17.patch, failed testing.

damiankloip’s picture

Status: Needs work » Reviewed & tested by the community
FileSize
24.47 KB

Subject to passing, this looks good. Just rerolled as reviewing (straight forward reroll).

dawehner’s picture

Thank you!!

alexpott’s picture

Committed aa56ce3 and pushed to 8.x. Thanks!

+++ b/core/modules/views/lib/Drupal/views/Tests/Handler/HandlerTest.phpundefined
@@ -10,6 +10,7 @@
 use Drupal\views\ViewExecutable;
 use Drupal\views\Tests\ViewTestBase;
 use Drupal\views\Plugin\views\HandlerBase;
+use Drupal\views\Views;

Removed unnecessarily added use statement during commit.

Dries’s picture

Status: Reviewed & tested by the community » Fixed

Committed to 8.x. Thanks!

Status: Fixed » Closed (fixed)

Automatically closed -- issue fixed for 2 weeks with no activity.

xjm’s picture

Title: Move views_get_handler into the handler plugin manager » [Change notice[ Move views_get_handler into the handler plugin manager
Project: Drupal core » Views (for Drupal 7)
Version: 8.x-dev » 8.x-3.x-dev
Component: views.module » Code
Status: Closed (fixed) » Active
Issue tags: +Needs change record
Chris Matthews’s picture

Project: Views (for Drupal 7) » Drupal core
Version: 8.x-3.x-dev » 8.7.x-dev
Component: Code » views.module
Issue summary: View changes

For more information as to why this issue was moved to the Drupal core project, please see issue #3030347: Plan to clean process issue queue

Chris Matthews’s picture

Project: Drupal core » Views (for Drupal 7)
Version: 8.7.x-dev » 7.x-3.x-dev
Component: views.module » Code
Status: Active » Closed (outdated)

Moving back to the contributed Views issue queue and closing as outdated per https://www.drupal.org/project/views/issues/3030347#comment-13023447