Batch redirect fails for views with path parameters

Created on 26 March 2020, almost 5 years ago
Updated 31 January 2023, almost 2 years ago

Problem/Motivation

If a view uses a parameter in the path (e.g. node/%/report), it is impossible to get a redirect to redirect to a URL that uses that parameter (e.g. node/%). This is true for both custom redirects and redirecting to a display.

Proposed resolution

  • For custom redirect we should expose the view arguments as tokens
  • For display redirect we should include the route parameters
🐛 Bug report
Status

Needs work

Version

1.0

Component

Code

Created by

🇬🇧United Kingdom andrewbelcher

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

Comments & Activities

Not all content is available!

It's likely this issue predates Contrib.social: some issue and comment data are missing.

  • 🇳🇿New Zealand jweowu

    Cross-referencing with 🐛 Batch data export triggers MissingMandatoryParametersException with contextual argument in URL Active in case followers of this will also understand how to resolve that.

  • Try the patch for implementation of "For custom redirect we should expose the view arguments as tokens"

    Created a view token which will take view path component as a variable argument.

  • 🇳🇿New Zealand amanp Poneke

    I confirm that patch in #4 resolves the MissingMandatoryParametersException for display redirects with Drupal 10.2 / views_data_export:1.4

  • 🇯🇴Jordan YousefAnbar Zarqa

    I confirm that patch in #4 works great for me with Drupal 9.5.11 / views_data_export:1.4

  • Status changed to Needs review 5 months ago
  • 🇺🇸United States AaronBauman Philadelphia

    Maybe I'm missing something, but this patch works for me.

    Very simply: we already have everything we need to generate the route from the view.

  • 🇸🇦Saudi Arabia abdulaziz zaid Riyadh

    thanks @aaronbauman

    your patch is working with and without checked 'Include query string parameters on redirect'

    you should pass the arg if the 'Include query string parameters on redirect' is checked.

  • 🇺🇸United States mediabounds

    The patch in #14 works for me.

    Previous comments requested being able to use path arguments as tokens if a custom redirect path is specified, but that is already possible (though not obvious).

    For example, if you had a redirect path of /users/%uid/submissions/export and wanted to redirect to /user/%uid/export-complete, you could specify the following in Custom redirect path:
    /users/[current-page:url:args:value:1]/export-complete

  • 🇬🇧United Kingdom steven jones

    Thanks for the patch in #14 we should get some tests in for this and make sure it works and continues to work!

  • 🇮🇳India chetananemade

    Hi,
    The patch in #11 worked well for us with Drupal 10.2 and Views_data_export 1.4.
    However, after upgrading to Drupal 10.3 and Views_data_export 1.5, we have updated the patch in #11 to make it compatible with the new versions.

Production build 0.71.5 2024