Problem/Motivation

template_preprocess_views_view_summary_unformatted() tries to determine the active link based on the <current> route.
But when using AJAX, the current route is /views/ajax so no active link is set.

Steps to reproduce

  1. Create a view displaying a summary.
  2. Enable AJAX on this view.
  3. Trigger an AJAX request.
  4. No active link is set.

Proposed resolution

\Drupal::service('path.current')->getPath() seems to get the current path correctly even in AJAX requests.

Remaining tasks

User interface changes

Introduced terminology

API changes

Data model changes

Release notes snippet

Issue fork drupal-3360996

Command icon Show commands

Start within a Git clone of the project using the version control instructions.

Or, if you do not have SSH keys set up on git.drupalcode.org:

Comments

prudloff created an issue. See original summary.

prudloff’s picture

Status: Active » Needs review
smustgrave’s picture

Status: Needs review » Needs work
Issue tags: +Needs tests

Will need a test case to show the bug.

Version: 9.5.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. For more information, see the Drupal core minor version schedule and the Allowed changes during the Drupal core release cycle.

prudloff’s picture

Status: Needs work » Needs review

Rebased and added a test.

prudloff’s picture

Issue summary: View changes
smustgrave’s picture

Status: Needs review » Reviewed & tested by the community
Issue tags: -Needs tests +Needs Review Queue Initiative

Removing tests tag as this shows coverage

1) Drupal\Tests\views\Kernel\Handler\ArgumentSummaryTest::testActiveLink
Failed asserting that false is true.
/builds/issue/drupal-3360996/core/modules/views/tests/src/Kernel/Handler/ArgumentSummaryTest.php:179
FAILURES!
Tests: 2, Assertions: 30, Failures: 1.
Exiting with EXIT_CODE=1

Since the actual change is a 1 liner and appears to fix the issue, going to mark.

catch’s picture

Status: Reviewed & tested by the community » Needs work

One comment on the MR.

prudloff’s picture

Status: Needs work » Needs review
smustgrave’s picture

Status: Needs review » Reviewed & tested by the community

Believe feedback has been addressed on this one.

alexpott’s picture

Version: 11.x-dev » 11.1.x-dev
Status: Reviewed & tested by the community » Fixed

Backported to 11.1.x as a bugfix.

Committed and pushed 42fb139e294 to 11.x and bd08e821d86 to 11.2.x and 335bc707498 to 11.1.x. Thanks!

  • alexpott committed 335bc707 on 11.1.x
    Issue #3360996 by prudloff, smustgrave, catch:...

  • alexpott committed bd08e821 on 11.2.x
    Issue #3360996 by prudloff, smustgrave, catch:...

  • alexpott committed 42fb139e on 11.x
    Issue #3360996 by prudloff, smustgrave, catch:...
alexpott’s picture

Status: Fixed » Closed (fixed)

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