Problem/Motivation

The Calendar module's pager does not generate correct URLs when used in non-page Views displays, such as blocks. This is because there is no route path to append the pager arguments to, so the current route is used, which may be inappropriate or incorrect.

Steps to reproduce

  1. Create a Calendar view with a block display (not a page display).
  2. Enable pager functionality (e.g., monthly navigation).
  3. Place the block on a page and attempt to use the pager links.
  4. Observe that the links are based on the current route, not on a meaningful calendar route.

Proposed resolution

Update the CalendarPager class to detect when the display has no base path (such as with blocks) and instead build pager links using query string parameters. Use the granularity as the key and append the argument value accordingly (e.g., ?month=2025-04).

Remaining tasks

  • Detect when the view display lacks a base path.
  • Update CalendarPager to generate query string links as a fallback.

Issue fork calendar-3518633

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

joelpittet created an issue. See original summary.

joelpittet’s picture

This is a quickfix but it needs a pager that reads the value too, though it is better than nothing as someone could write a Views argument or argument default plugin that would read from the query string.

Side comment in the issue summary I wrote ?month=2025-04 even though I know in D8+ the month arg is in Ym format. I would like to see this easily configurable because ?month=202504 is practical but not a great hackable/human parseable URL

joelpittet’s picture

joelpittet’s picture

Status: Active » Needs review