There is an issue with the summary in contextual filters. I've added two filters:

  1. Country Code
  2. Administrative Area

My goal is to make users browse through my nodes like so:

(level 1)

US (14409)
CA (1245)
DK (414)
JP (9942)
...

(level 2 - JP)

Region 1 (1442)
Region 2 (134)
Region 3 (254)
...

Display a summary works like desired in terms of aggregating the results, but the URLs for those links are wrong. For instance, when clicking on the summary link of the first level (e.g. JP (9942) ), instead of "my_view/JP/" users are linked to "my_view/JP/all". That way, users can't access the filter on the second level but instead are presented with all results for this level.

How do I get rid of this argument? Would URL redirect be a good solution?

EDIT:

Also, breadcrumb navigation does not seem to work.

Support from Acquia helps fund testing for Drupal Acquia logo

Comments

Daniel Schaefer created an issue. See original summary.

Daniel Schaefer’s picture

Priority: Normal » Major
Issue summary: View changes
Issue tags: +views contextual filter, +Contextual filters
Daniel Schaefer’s picture

Priority: Major » Normal

Version: 8.2.x-dev » 8.3.x-dev

Drupal 8.2.0-beta1 was released on August 3, 2016, which means new developments and disruptive changes should now be targeted against the 8.3.x-dev branch. For more information see the Drupal 8 minor version schedule and the Allowed changes during the Drupal 8 release cycle.

Version: 8.3.x-dev » 8.4.x-dev

Drupal 8.3.0-alpha1 will be released the week of January 30, 2017, which means new developments and disruptive changes should now be targeted against the 8.4.x-dev branch. For more information see the Drupal 8 minor version schedule and the Allowed changes during the Drupal 8 release cycle.

HongPong’s picture

Also having similar bad URLs on summaries: if the summaries are on a block, then the URLs are to the main page display on the view.

When there was a feed, the summary was grabbing the feed URL. when i removed the feed, it went to the first page url. going to make my summary blocks in a separate view to see if that works better.

Problem may be around something like: display.block_1.display_options.arguments.created_year.summary_options.base_path (which is empty in my problematic view)

Version: 8.4.x-dev » 8.5.x-dev

Drupal 8.4.0-alpha1 will be released the week of July 31, 2017, which means new developments and disruptive changes should now be targeted against the 8.5.x-dev branch. For more information see the Drupal 8 minor version schedule and the Allowed changes during the Drupal 8 release cycle.

Daniel Schaefer’s picture

I am building a new website with this feature and the bug is still persistent.

view configuration

CONTEXTUAL FILTERS
(Product terms) Taxonomy term: Name
Content: Location:country_code
Content: Location:locality

(all have summary selected with basis validation)

RELATIONSHIPS
Product terms (Terms on node, Vocabulary Products)

Output

Level 1

The product selection:

  • Shoes (155) -> {view_url}/shoes (expected) {view_url}/shoes/all/all/all (reality)
  • Trousers (962)

Level 2

the Shoe page (shoes):

  • AL -> {view_url}/shoes/AL (expected) {view_url}/shoes/all (reality)
  • US -> {view_url}/shoes/US
  • UK -> {view_url}/shoes/UK

Level 3

the Country Page (shoes/AL):

  • Saranda (15) {view_url}/shoes/AL/Saranda (the link is correct here)
  • Tirana (21)

Where are these "all" links being set??

Daniel Schaefer’s picture

Title: Views incorrectly adding "all" parameter to summary links » Views incorrectly adding "all" parameter to contextual filter summary links
Daniel Schaefer’s picture

Is nobody reading this?

Lendude’s picture

@Daniel Schaefer sure I read it, just have nothing to add right now

HongPong’s picture

If we can determine which classes or plugins are having the bad information here, that would be a step forward. Sometimes these things are hard as heck to dig out. Once we know that, we can dump the vars out. I don't know the innards of d8 views that well, tho.

HongPong’s picture

views/src/Plugin/views/style/DefaultSummary.php is the fallback for summaries.

views/src/Plugin/views/style/UnformattedSummary.php is the another formatter.

views/src/Plugin/views/argument/ArgumentPluginBase.php has the default form for summaries. A lot of stuff in here.

views/src/Plugin/views/argument/StringArgument.php has summaryQuery() builds the summary query based on a string.

Also several yml files have settings for summaries in the tests. Speculating here I would bet the bug lies somewhere in one of these. If you put dump statements all over the functions in here the bug might turn up as a bad handling of an array or a default option somewhere.

Daniel Schaefer’s picture

Thank you HongPong. I'm still fairly new to the concept of 8, but that should get me started.

Lendude’s picture

Status: Active » Needs review
FileSize
1.21 KB

Closed #2853661: Views contextual + global null + exposed filter introduces extra url param as a duplicate of this.

Here is a patch that works locally with the View provided in #2853661: Views contextual + global null + exposed filter introduces extra url param. You would have to remove the Null argument and re-add it to make sure it has the updated options.

I'm sure this will (should) fail other scenarios, since the 'fix' in \Drupal\views\ViewExecutable is hardly well thought out. But it should provide an indication where we need to look for a fix.

Status: Needs review » Needs work

The last submitted patch, 16: 2767331-16.patch, failed testing. View results

Version: 8.5.x-dev » 8.6.x-dev

Drupal 8.5.0-alpha1 will be released the week of January 17, 2018, which means new developments and disruptive changes should now be targeted against the 8.6.x-dev branch. For more information see the Drupal 8 minor version schedule and the Allowed changes during the Drupal 8 release cycle.

Version: 8.6.x-dev » 8.7.x-dev

Drupal 8.6.0-alpha1 will be released the week of July 16, 2018, which means new developments and disruptive changes should now be targeted against the 8.7.x-dev branch. For more information see the Drupal 8 minor version schedule and the Allowed changes during the Drupal 8 release cycle.

Version: 8.7.x-dev » 8.8.x-dev

Drupal 8.7.0-alpha1 will be released the week of March 11, 2019, which means new developments and disruptive changes should now be targeted against the 8.8.x-dev branch. For more information see the Drupal 8 minor version schedule and the Allowed changes during the Drupal 8 release cycle.

Version: 8.8.x-dev » 8.9.x-dev

Drupal 8.8.0-alpha1 will be released the week of October 14th, 2019, which means new developments and disruptive changes should now be targeted against the 8.9.x-dev branch. (Any changes to 8.9.x will also be committed to 9.0.x in preparation for Drupal 9’s release, but some changes like significant feature additions will be deferred to 9.1.x.). For more information see the Drupal 8 and 9 minor version schedule and the Allowed changes during the Drupal 8 and 9 release cycles.

gnosis’s picture

This also happens with display links "Global: Link to display", which is used to create the Grid and Table links used by the Media Library widget now in core, via the Media Library view.

Those Grid and Table links will ignore contextual filters, adding the "all" whether it's wanted or not. Actually, it adds whatever has been given in the contextual filter's "Exception Value" field. If you blank that field, the link is rendered with an asterisk, which also breaks the contextual filter.

Thus, anyone wishing to add contextual filters to the Media Library view will see their filters ignored when the user clicks the Grid or Table links to change the display.

Issue 2853661 is closed as dupe but has, IMO, a better description of the problem.

alianov’s picture

I've noticed that default_argument_skip_url is not being respected.

Version: 8.9.x-dev » 9.1.x-dev

Drupal 8.9.0-beta1 was released on March 20, 2020. 8.9.x is the final, long-term support (LTS) minor release of Drupal 8, which means new developments and disruptive changes should now be targeted against the 9.1.x-dev branch. For more information see the Drupal 8 and 9 minor version schedule and the Allowed changes during the Drupal 8 and 9 release cycles.

Version: 9.1.x-dev » 9.2.x-dev

Drupal 9.1.0-alpha1 will be released the week of October 19, 2020, which means new developments and disruptive changes should now be targeted for the 9.2.x-dev branch. For more information see the Drupal 9 minor version schedule and the Allowed changes during the Drupal 9 release cycle.

Version: 9.2.x-dev » 9.3.x-dev

Drupal 9.2.0-alpha1 will be released the week of May 3, 2021, which means new developments and disruptive changes should now be targeted for the 9.3.x-dev branch. For more information see the Drupal core minor version schedule and the Allowed changes during the Drupal core release cycle.

Version: 9.3.x-dev » 9.4.x-dev

Drupal 9.3.0-rc1 was released on November 26, 2021, which means new developments and disruptive changes should now be targeted for the 9.4.x-dev branch. For more information see the Drupal core minor version schedule and the Allowed changes during the Drupal core release cycle.

Version: 9.4.x-dev » 9.5.x-dev

Drupal 9.4.0-alpha1 was released on May 6, 2022, which means new developments and disruptive changes should now be targeted for the 9.5.x-dev branch. For more information see the Drupal core minor version schedule and the Allowed changes during the Drupal core release cycle.

Version: 9.5.x-dev » 10.1.x-dev

Drupal 9.5.0-beta2 and Drupal 10.0.0-beta2 were released on September 29, 2022, which means new developments and disruptive changes should now be targeted for the 10.1.x-dev branch. For more information see the Drupal core minor version schedule and the Allowed changes during the Drupal core release cycle.

Version: 10.1.x-dev » 11.x-dev

Drupal core is moving towards using a “main” branch. As an interim step, a new 11.x branch has been opened, as Drupal.org infrastructure cannot currently fully support a branch named main. New developments and disruptive changes should now be targeted for the 11.x branch, which currently accepts only minor-version allowed changes. For more information, see the Drupal core minor version schedule and the Allowed changes during the Drupal core release cycle.

mohit_aghera’s picture

I came to this issue via Bugsmash daily traige.

I think we need to do some work on the solution.
The option that is used in the patch #23 is removed now.
Issue that removed the option: https://www.drupal.org/node/981870

I am able to reproduce the issue. However slightly confused whether I took right steps to reproduce the issue.
I'm going to upload the issue along with the test-only patch and a fix.
Here https://pastebin.com/cJweDtHX is the view that I used for testing purposes.

Further investigation:
IMO, `all` option is appearing because one might have kept exception value as `all`
So even if we remove that value default value will still be * i.e. %2A in the URL
Reference https://git.drupalcode.org/project/drupal/-/blob/11.x/core/modules/views...

So one way to fix this could be something like empty fallback value instead of "*"

          // Provide some fallback in case no exception value could be found.
          $parameters[$variable_name] = '';
Lendude’s picture

Works fine without the exposed filter, only breaks for me using the exposed filter first.

Uh use facets module? ;)