"More" link not taking default arguments into account

Created on 20 February 2024, 4 months ago
Updated 8 April 2024, 2 months ago

Problem/Motivation

Since Drupal 10.2, the "More" link in views does not respect the default arguments anymore. This leads to instances where the "More" link points to wrong and/or inaccessible pages.

Steps to reproduce

1. Install Drupal 10.1.8 and Drupal 10.2.3 in the standard configuration. In both instances, follow the following steps:
2. Install the forum module
3. Import the attached view and the attached block config
4. Navigate to /forum/1
5. Inspect the "More" link in the views block in the sidebar
ā†’ In Drupal <10.2, the link is correctly pointing to /forums/1/page
ā†’ Since Drupal 10.2, the link is pointing to /forums/all/page (ā†’ the "1" is dropped as an argument)

Proposed resolution

I think that #981870 šŸ“Œ Skip default argument for view URL does not work and never has so it can be removed Fixed introduced this regression. In particular, in the ViewExecutable.php the following code in the getUrl() method was changed from

          if (!empty($argument->is_default) && !empty($argument->options['default_argument_skip_url'])) {
            unset($args[$position]);
          }

to

          if (!empty($argument->is_default)) {
            unset($args[$position]);
          }

This way, as far as I understand it, default arguments are now always skipped by default. I'm not sure if that behavior was intended. My understanding is that the opposite should be the case, i.e., the default arguments should never be skipped.

If my understanding is wrong, I think the change record ā†’ is highly misleading since it doesn't imply a necessity to re-configure any views, especially not views that did not even use the "Skip default argument for view URL" function.

Remaining tasks

- Write actual fix

šŸ› Bug report
Status

Fixed

Version

10.2 āœØ

Component
ViewsĀ  ā†’

Last updated about 1 hour ago

Created by

Live updates comments and jobs are added and updated live.
Sign in to follow issues

Merge Requests

Comments & Activities

Production build 0.69.0 2024