Error on redirect to display that uses contextual filters and route parameters

Created on 5 November 2024, 3 months ago

Problem/Motivation

If the data export view is configured to redirect to a display that uses route parameters, the export will return an "unexpected error" page with a similar error to this in the logs:

Symfony\Component\Routing\Exception\MissingMandatoryParametersException: Some mandatory parameters are missing ("user") to generate a URL for route "view.example.user_data_page". in Drupal\Core\Routing\UrlGenerator->doGenerate() (line 187 of .../web/core/lib/Drupal/Core/Routing/UrlGenerator.php).

Steps to reproduce

Add a view that uses a contextual filter, for example a "User data" view under the user profile page

Path: /user/%user/data
Menu: Tab: User data
Contextual filter: (uid) User: User ID

Add a data export attached to that page

Path: /user/%user/data/export
Attach to: User data
Redirect to this display: User data

When visiting the export display, the error will be returned, because the route parameters in the attached display cannot be determined.

Proposed resolution

Update the redirect URL logic to include the route parameters for the redirect destination display.

Remaining tasks

Add a patch to views_data_export/src/Plugin/views/display/DataExport.php

I have a patch and will add an MR shortly.

User interface changes

No changes

API changes

No changes

Data model changes

No changes

🐛 Bug report
Status

Active

Version

2.0

Component

Code

Created by

🇳🇿New Zealand davidwhthomas

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

Merge Requests

Comments & Activities

Production build 0.71.5 2024