Support for Drupal 7 is ending on 5 January 2025—it’s time to migrate to Drupal 10! Learn about the many benefits of Drupal 10 and find migration tools in our resource center.
If you look at the views UI preview you get like
An AJAX HTTP error occurred.
HTTP Result Code: 404
Debugging information follows.
Path: /d8/admin/structure/views/view/content/preview/page_1
StatusText: Not Found
ResponseText: A fatal error occurred: Unable to find the controller for path "/admin/structure/views/view/content/preview/page_1". Maybe you forgot to add the matching route in your routing configuration?
Comment | File | Size | Author |
---|---|---|---|
#37 | ajax_entity_routes-1983164-37.patch | 10.75 KB | dawehner |
#37 | interdiff.txt | 611 bytes | dawehner |
#33 | entity-form-routes-1983164.33.interdiff.txt | 1.81 KB | larowlan |
#33 | entity-form-routes-1983164.33.patch | 10.75 KB | larowlan |
#30 | Screen Shot 2013-06-03 at 8.44.57 AM.png | 21.77 KB | larowlan |
Comments
Comment #1
dawehnerThere seems to be the central problem, that RouteListener does the following:
but on the AjaxController subrequest controller is set to NULL, by HttpKernel::forward().
That's certainly not enough to fix the bug, but applying the bug is fun, see screenshot :)
Comment #2
dawehnerBefore the patch in #1913618: Convert EntityFormControllerInterface to extend FormInterface ViewsUIController took care about returning the preview as ajax. Now HtmlFormController::content() returns the full rendered page including the form.
Comment #3
tim.plunkettCan we test this in any way? :\
Comment #4
dawehnerWhat about something like this?
Comment #6
tim.plunkettAwesome, we have a test!
Comment #7
clemens.tolboomAccording to discussion https://github.com/symfony/symfony/issues/4360 SubRequest is always a get request. But preview is a Post request. Does that somehow match the recursion art from #1
(my 2cents and subscribing)
Comment #8
dawehnerOne initial additional idea has been to use another route enhancer to enhance based upon the content type, similar to the way DialogEnhancer and ModalEnhancer work together. This though is not really a good model, just because there are multiple controllers for different kind of forms: normal forms, entity forms etc.
We should really start thinking about a proper system to allow all this but to be honest the change in #1913618: Convert EntityFormControllerInterface to extend FormInterface feels wrong.
Comment #9
dawehnerThis has been my previous attemps, but yeah this doesn't work as described.
I personally think that there shouldn't be an html form controller but just a html page controller, which takes the output of the form controller.
Comment #10
clemens.tolboomShould be Response and it should be USE-ed
(just to let know I read it)
Why isn't the whole form replaced by the response of the preview?
And shouldn't auto-preview be stunned after the result?
(questions from a Router rookie)
Comment #11
dcam CreditAttribution: dcam commentedhttp://drupal.org/node/1427826 contains instructions for updating the issue summary with the summary template.
The summary may need to be updated with information from comments.
Comment #12
dawehnerThis is a start to implement subrequest handling.
Comment #13
dawehnerThere we go.
I will work on proper tests now.
Comment #14
dawehner.
Comment #15
dawehnerAdded a unit test for HttpKernel.
Comment #17
dawehnerOh right this testfile is not needed anymore.
Comment #18
dawehnerLet's make the changes in HttpKernel as small as possible.
Comment #19
tim.plunkettIf you need another reroll, might as well
return drupal_build_form($form_id, $form_state)
This looks good to me, but I'd like to have Crell or larowlan RTBC.
Comment #20
larowlanstring|NULL passing NULL means the sub-request has the enhancers etc run again - we should note this
Comment #21
dawehnerLet's do it.
Pushed to 1983164-ajax-subrequest
Comment #22
larowlanThis is needed because without it this chunk in Drupal\Core\ContentNegotiation leads us to believe that its still an ajax request, even in the sub-request.
the isXmlHttpRequest() method checks the x-requested-with header. Can we update the comment?
Other than that this looks RTBC to me too and unblocks #1998698: Allow Dialog Controller to work with form/entity form routes
Comment #23
dawehnerUpdated the patch.
Comment #24
larowlanInstalls fine but doesn't fix the original issue.
Perhaps missing a call to drupal_render - we're seeing Array instead of the output?
Comment #25
dawehnerLet's fixes at least one problem.
Comment #27
dawehnerSince #1843744: Convert views/templates/views-view.tpl.php to twig the render call is missing.
Comment #29
dawehnerLet's fix the exception.
Comment #30
larowlanWorks as expected™
Comment #31
damiankloip CreditAttribution: damiankloip commentedOverall, you are a HERO. Also just tested and can happily confirm I have my preview back!
Couple of small things, sorry....
'Sets up the' or 'Creates a'
NULL? Not sure.
Can't we just return the result here directly instead of assigning?
Who is the js commando? :)
Comment #32
larowlanre-rolling
Comment #33
larowlanFixes #31
Comment #34
andypostwhy not drupal_render() here? is it possible to be empty?
Comment #36
tim.plunkett#33: entity-form-routes-1983164.33.patch queued for re-testing.
Comment #37
dawehnerI don't care.
Comment #38
larowlanComment #40
tim.plunkett#37: ajax_entity_routes-1983164-37.patch queued for re-testing.
Comment #41
dawehnerSo back to RTBC
Comment #42
alexpottCommitted 7166d89 and pushed to 8.x. Thanks!