Since the release of alpha-9, the default argument for term ID taken from the active node has stopped functioning.

Steps to reproduce:

Create a view of content.
Add a block display.
Add the "Has taxonomy term ID filter"
Under "When the filter is not available", select "Taxonomy term ID from URL", then check "Load default filter from node page, that's good for related taxonomy blocks."
Save the view and create content tagged with a taxonomy term.
Set the block to display, and visit a node page that is tagged with a term.
Observe that no content shows.

Comments

rbayliss’s picture

Status: Active » Needs review
StatusFileSize
new905 bytes
rbayliss’s picture

StatusFileSize
new915 bytes

Reroll.

rbayliss’s picture

Title: Taxonomy default argument no longer works for node terms » Taxonomy default argument no longer works
StatusFileSize
new8.48 KB
new7.14 KB

Looks like this has become even more broken - in addition to the "Load default filter from node page" not working, I'm now getting a fatal if "Load default filter from term page" is checked. Pretty clear we need some tests I guess. Here's a reroll of the previous patch with the fix for the fatal, and a test for both.

olli’s picture

Priority: Normal » Major
Issue tags: +VDC
dawehner’s picture

Status: Needs review » Needs work

Thank you for your work on this issue, especially given that it has some proper test.

  1. +++ b/core/modules/taxonomy/src/Tests/Views/TaxonomyDefaultArgumentTest.php
    @@ -0,0 +1,56 @@
    +    $request = Request::create($this->nodes[0]->getSystemPath());
    +    $response = $this->container->get('http_kernel')->handle($request, HttpKernelInterface::SUB_REQUEST);
    +    $view->setRequest($request);
    +    $view->setResponse($response);
    

    <3 but here is a question, can't we directly use a kernel test base in that case?

  2. +++ b/core/modules/taxonomy/tests/modules/taxonomy_test_views/test_views/views.view.taxonomy_default_argument_test.yml
    @@ -0,0 +1,181 @@
    +uuid: 1d0eac38-17a7-45b8-a900-ea5debec019d
    

    We don't store UUIDs for test views.

  3. +++ b/core/modules/taxonomy/tests/modules/taxonomy_test_views/test_views/views.view.taxonomy_default_argument_test.yml
    @@ -0,0 +1,181 @@
    +      field_langcode: '***CURRENT_LANGUAGE***'
    

    This view should be probably reexported, because for example this value is now different.

rbayliss’s picture

Status: Needs work » Needs review
StatusFileSize
new8.44 KB

Thanks for the feedback. In theory I think we could use KernelTestBase for that test, but it would involve a lot of duplication of code between the TaxonomyTestBase to recreate the nodes and terms with the proper fields (more code than the tests themselves actually), so I'm not convinced it's worth it. Feel free to kick it back to needs work if you disagree.

Reroll to remove UUID and update the field_language value.

dawehner’s picture

Status: Needs review » Reviewed & tested by the community

+1

alexpott’s picture

Status: Reviewed & tested by the community » Fixed

Committed d76bf40 and pushed to 8.0.x. Thanks!

  • alexpott committed d76bf40 on 8.0.x
    Issue #2202565 by rbayliss: Fixed Taxonomy default argument no longer...

Status: Fixed » Closed (fixed)

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