Problem/Motivation

The default Taxonomy view preview is broken.

Proposed resolution

Steps to reproduce

  1. Do a standard install.
  2. Tag some content with a taxonomy term.
  3. Be sure you can browse the tagged content at taxonomy/term/1, assuming the term you tagged is the first one.
  4. Edit the Taxonomy term view at admin/structure/views/view/taxonomy_term
  5. An 500 error is returned on the Ajax call for the preview.
  6. Type 1 in the "Preview with contextual filters" in the preview box.
  7. No content is shown in the preview.

Errors

When the view editor loads, this PHP fatal occurs:

PHP Fatal error:  Call to a member function getRouteByName() on a non-object in /Library/WebServer/Documents/drupal8x/core/modules/views/src/ViewExecutable.php on line 1818, referer: http://localhost/drupal8x/admin/structure/views/view/taxonomy_term

The browser console error is:

Uncaught AjaxError: 
An AJAX HTTP error occurred.
HTTP Result Code: 500
Debugging information follows.
Path: /drupal8x/admin/structure/views/view/taxonomy_term/preview/page_1
StatusText: Internal Server Error

Remaining tasks

User interface changes

API changes

Support from Acquia helps fund testing for Drupal Acquia logo

Comments

cilefen’s picture

Issue summary: View changes
cilefen’s picture

Title: Contextual filters don't work in Taxonomy term View preview » Taxonomy term View preview is broken
cilefen’s picture

Issue summary: View changes
cilefen’s picture

The problem is that ViewExecutable::routeProvider has not been set in this case.

Line 1818

    /** @var \Drupal\Core\Url $url */
    $url = $display_handler->getUrlInfo();
    $route = $this->routeProvider->getRouteByName($url->getRouteName());
cilefen’s picture

Priority: Normal » Major
Status: Active » Needs review
FileSize
1.35 KB

In this patch, I save the route provider before $executable is destroyed, then re-set it.

cilefen’s picture

Here is a simpler way to get the same result: Do not strip the routeProvider from ViewExecutable when it is destroyed.

Status: Needs review » Needs work

The last submitted patch, 6: taxonomy_term_view-2452659-6.patch, failed testing.

cilefen’s picture

Status: Needs work » Needs review
FileSize
675 bytes
1.47 KB
cilefen’s picture

The last submitted patch, 9: taxonomy_term_view-2452659-9-test.patch, failed testing.

olli’s picture

dawehner’s picture

Status: Needs review » Reviewed & tested by the community

Good point!

webchick’s picture

Status: Reviewed & tested by the community » Fixed

Committed and pushed to 8.0.x. Thanks!

  • webchick committed 261e709 on 8.0.x
    Issue #2452659 by cilefen: Taxonomy term View preview is broken
    

Status: Fixed » Closed (fixed)

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