Convert the page callback "views_ajax" to a new-style Controller, using the instructions in the WSCCI Conversion Guide.

@see views_menu() in core/modules/views/views.module

Support from Acquia helps fund testing for Drupal Acquia logo

Comments

xjm’s picture

Status: Active » Postponed

Since this is an AJAX callback rather than a full page callback, we should wait on #1944472: Add generic content handler for returning dialogs.

xjm’s picture

Issue tags: +VDC
jibran’s picture

dawehner’s picture

Status: Active » Needs review
FileSize
9.36 KB

I started already but sadly there are still problems with exposed forms.

dawehner’s picture

FileSize
570 bytes
9.37 KB

There we go.

Status: Needs review » Needs work
Issue tags: -VDC, -WSCCI-conversion

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

dawehner’s picture

Status: Needs work » Needs review
Issue tags: +VDC, +WSCCI-conversion

#5: drupal-1979036-5.patch queued for re-testing.

ParisLiakos’s picture

awesome!

+++ b/core/modules/views/lib/Drupal/views/Controller/ViewAjaxController.phpundefined
@@ -0,0 +1,136 @@
+          _current_path($path);

lets use the $request here
$request->attributes->get('system_path');

_current_path will hopefully die before release

dawehner’s picture

FileSize
711 bytes
9.39 KB

Cool.

damiankloip’s picture

I guess it's not ideal to use request::get() in a controller like this? I guess it makes sense in this case though?

damiankloip’s picture

Status: Needs review » Reviewed & tested by the community

I think it probably does.

Dries’s picture

Status: Reviewed & tested by the community » Needs review
Issue tags: +Needs manual testing

Given that this involves AJAX, I'd like to see us do thorough manual testing of this patch. Could someone please do that and confirm that things still work? Thanks!

xjm’s picture

Also, re: #4, it sounds like there was a bug, but the patch still passed? Is there something we could add an automated test for?

glennpratt’s picture

Assigned: Unassigned » glennpratt

Manually testing today at Acquia sprint.

glennpratt’s picture

Status: Needs review » Reviewed & tested by the community

Not sure about #13 / #4 but the patch seems to work for me.

http://screencast.com/t/exrj6JdaTv3X

dawehner’s picture

glennpratt’s picture

Assigned: glennpratt » Unassigned
dawehner’s picture

Issue tags: -Needs manual testing
alexpott’s picture

Status: Reviewed & tested by the community » Needs work
+++ b/core/modules/views/views.moduleundefined
@@ -296,13 +296,9 @@ function views_menu() {
   $items['views/ajax'] = array(
     'title' => 'Views',
-    'page callback' => 'views_ajax',
     'theme callback' => 'ajax_base_page_theme',
-    'delivery callback' => 'ajax_deliver',
-    'access callback' => TRUE,
-    'description' => 'Ajax callback for view loading.',
+    'route_name' => 'views_ajax',
     'type' => MENU_CALLBACK,
-    'file' => 'includes/ajax.inc',
   );

Shouldn't we be removing this? I guess we've left this in for the theme callback... have you tried removing it?

dawehner’s picture

So alternative to "theme callback" it would be possible to temporally port it to use hook_custom_theme for now.

dawehner’s picture

Status: Needs work » Needs review

#9: drupal-1979036-9.patch queued for re-testing.

dawehner’s picture

dawehner’s picture

FileSize
2.05 KB
9.67 KB

Fixed some minor stuff.

ParisLiakos’s picture

Status: Needs review » Reviewed & tested by the community

totally forgot this one

fubhy’s picture

Status: Reviewed & tested by the community » Needs work
+++ b/core/modules/views/lib/Drupal/views/Controller/ViewAjaxController.phpundefined
@@ -0,0 +1,146 @@
+   *   The factory to load a view executable.

The factory for loading a view executable... or: The factory to load a view executable with.

+++ b/core/modules/views/lib/Drupal/views/Controller/ViewAjaxController.phpundefined
@@ -0,0 +1,146 @@
+   * Loads and render a view via AJAX.

Loads and renderS a view via Ajax.

+++ b/core/modules/views/lib/Drupal/views/Controller/ViewAjaxController.phpundefined
@@ -0,0 +1,146 @@
+   *  The current request object.

Missing whitespace before the "The"

+++ b/core/modules/views/lib/Drupal/views/Controller/ViewAjaxController.phpundefined
@@ -0,0 +1,146 @@
+      // Remove all of this stuff from the query of the request so it doesn't end

Exceeds 80 characters.

+++ b/core/modules/views/lib/Drupal/views/Controller/ViewAjaxController.phpundefined
@@ -0,0 +1,146 @@
+        if ($request->query->has($key)) {
+          $request->query->remove($key);
+        }
+        if ($request->request->has($key)) {
+          $request->request->remove($key);
+        }

Those has() checks are redundant. Simply call ->remove() without them.

+++ b/core/modules/views/lib/Drupal/views/Controller/ViewAjaxController.phpundefined
@@ -0,0 +1,146 @@
+        $query = Url::buildQuery($request->query->all());

You already filled $query_all before, you can re-use that here :)

dawehner’s picture

Status: Needs work » Needs review
FileSize
2.53 KB
9.57 KB

Thanks for the good review.

You already filled $query_all before, you can re-use that here :)

No we can't, because the values have been changed in the meantime.

fubhy’s picture

Status: Needs review » Reviewed & tested by the community

RTBC if green

Crell’s picture

+++ b/core/modules/views/views.module
@@ -297,13 +297,9 @@ function views_menu() {
   $items['views/ajax'] = array(
     'title' => 'Views',
-    'page callback' => 'views_ajax',
     'theme callback' => 'ajax_base_page_theme',
-    'delivery callback' => 'ajax_deliver',
-    'access callback' => TRUE,
-    'description' => 'Ajax callback for view loading.',
+    'route_name' => 'views_ajax',
     'type' => MENU_CALLBACK,
-    'file' => 'includes/ajax.inc',
   );

This is a MENU_CALLBACK, which means it no longer needs to exist, I believe. It can be removed entirely.

dawehner’s picture

Crell, you followed in the steps of alexpott, but there is still 'theme callback' which is needed, see #1979036-19: Convert views_ajax() to a Controller and #1979036-20: Convert views_ajax() to a Controller

Crell’s picture

D'Oh. At least I have good role models. :-)

dawehner’s picture

#26: vdc-1979036-26.patch queued for re-testing.

alexpott’s picture

Status: Reviewed & tested by the community » Fixed

Committed 338705a and pushed to 8.x. Thanks!

xjm’s picture

Title: Convert views_ajax() to a Controller » [Change notice] Convert views_ajax() to a Controller
Project: Drupal core » Views (for Drupal 7)
Version: 8.x-dev » 8.x-3.x-dev
Component: views.module » Code
Status: Fixed » Active
Issue tags: +Needs change record
damiankloip’s picture

Really? We need a change notice for an ajax path internal to views? We haven't created change notices for all of our route conversions.

dawehner’s picture

Title: [Change notice] Convert views_ajax() to a Controller » Convert views_ajax() to a Controller
Status: Active » Fixed

I totally agree with damian. We don't convert when page callbacks gets converted to controllers.

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

Anonymous’s picture

Issue summary: View changes

Updated issue summary.