Loading core/modules/taxonomy/src/Plugin/views/argument_default/Tid.php +13 −0 Original line number Diff line number Diff line Loading @@ -197,6 +197,19 @@ public function getArgument() { } } /** * {@inheritdoc} */ public function getCacheTags() { $tags = parent::getCacheTags(); if (!empty($this->options['node'])) { if (($node = $this->routeMatch->getParameter('node')) && $node instanceof NodeInterface) { $tags = Cache::mergeTags($tags, $node->getCacheTags()); } } return $tags; } /** * {@inheritdoc} */ Loading core/modules/taxonomy/tests/src/Kernel/Views/TaxonomyDefaultArgumentTest.php +3 −0 Original line number Diff line number Diff line Loading @@ -61,6 +61,7 @@ public function testNodePath() { $expected = implode(',', [$this->term1->id(), $this->term2->id()]); $this->assertEquals($expected, $view->argument['tid']->getDefaultArgument()); $this->assertEquals($this->nodes[0]->getCacheTags(), $view->argument['tid']->getPlugin('argument_default')->getCacheTags()); $view->destroy(); } Loading @@ -83,6 +84,7 @@ public function testNodePathWithViewSelection() { $expected = implode(',', [$this->term1->id(), $this->term2->id()]); $this->assertEquals($expected, $view->argument['tid']->getDefaultArgument()); $this->assertEquals($this->nodes[0]->getCacheTags(), $view->argument['tid']->getPlugin('argument_default')->getCacheTags()); } public function testTermPath() { Loading @@ -90,6 +92,7 @@ public function testTermPath() { $expected = $this->term1->id(); $this->assertEquals($expected, $view->argument['tid']->getDefaultArgument()); $this->assertEmpty($view->argument['tid']->getPlugin('argument_default')->getCacheTags()); } } Loading
core/modules/taxonomy/src/Plugin/views/argument_default/Tid.php +13 −0 Original line number Diff line number Diff line Loading @@ -197,6 +197,19 @@ public function getArgument() { } } /** * {@inheritdoc} */ public function getCacheTags() { $tags = parent::getCacheTags(); if (!empty($this->options['node'])) { if (($node = $this->routeMatch->getParameter('node')) && $node instanceof NodeInterface) { $tags = Cache::mergeTags($tags, $node->getCacheTags()); } } return $tags; } /** * {@inheritdoc} */ Loading
core/modules/taxonomy/tests/src/Kernel/Views/TaxonomyDefaultArgumentTest.php +3 −0 Original line number Diff line number Diff line Loading @@ -61,6 +61,7 @@ public function testNodePath() { $expected = implode(',', [$this->term1->id(), $this->term2->id()]); $this->assertEquals($expected, $view->argument['tid']->getDefaultArgument()); $this->assertEquals($this->nodes[0]->getCacheTags(), $view->argument['tid']->getPlugin('argument_default')->getCacheTags()); $view->destroy(); } Loading @@ -83,6 +84,7 @@ public function testNodePathWithViewSelection() { $expected = implode(',', [$this->term1->id(), $this->term2->id()]); $this->assertEquals($expected, $view->argument['tid']->getDefaultArgument()); $this->assertEquals($this->nodes[0]->getCacheTags(), $view->argument['tid']->getPlugin('argument_default')->getCacheTags()); } public function testTermPath() { Loading @@ -90,6 +92,7 @@ public function testTermPath() { $expected = $this->term1->id(); $this->assertEquals($expected, $view->argument['tid']->getDefaultArgument()); $this->assertEmpty($view->argument['tid']->getPlugin('argument_default')->getCacheTags()); } }