Support for Drupal 7 is ending on 5 January 2025—it’s time to migrate to Drupal 10! Learn about the many benefits of Drupal 10 and find migration tools in our resource center.
When I do an export and I want to return to the view I was on then I expect the return url to remember what filters that I've used. But it doesn't seem to do this. I quickly looked in the dev code and didn't see it there either. Or am I missing something?
Comments
Comment #1
SpadXIII CreditAttribution: SpadXIII at ezCompany commentedThis commit should fix this: http://cgit.drupalcode.org/views_data_export/commit/?id=584e8767f5a2bef2...
But it doesn't work with batched-exports.
Comment #2
SpadXIII CreditAttribution: SpadXIII at ezCompany commentedI managed to work around this issue for my (batched) view by overriding views_data_export_plugin_display_export with my own class in which I save the exposed_input in the first 'execute' and use it in the 'render_complete' for the return url query parameters.
Note: this solution returns the user to the previous page instead of showing a return-link.
Comment #3
GuyPaddock CreditAttribution: GuyPaddock at Inveniem commentedI think the root cause is actually this in Views #2275119: views::get_url() works incorrectly when there is an argument in the path.
Comment #4
GuyPaddock CreditAttribution: GuyPaddock at Inveniem commentedAs far as workarounds go, another point of injection is in
hook_views_data_export_batch_alter()
. The$final_destination
argument to that alter hook can be modified to change where'return-url'
points. That still leaves the original problem of getting the URL to the view with the arguments applied, but at least there's an injection point that's easier than duplicating the entire export plug-in just to override the behavior.For example, in our case we just want to remove the buggy link until this ticket is addressed:
As a side note, it appears that for a view we are using this with that has exposed filters,
request_uri()
inside ourhook_views_data_export_batch_alter()
contains the full URL of the export display/page with the exposed filters applied (i.e. our normal page display path is/search
and the export page is/search.csv
, so the request URI ends up being/search.csv?arg1=arg1_value&arg2=arg2_value
, etc.). Given that, a possible workaround might be to reconstitute the correct return URL from a combination of the normal display path and the query string parameters passed in the request URI of the export display/page. Maybe even a string replace of the export page for the normal page URI would do the trick, for now, until the root cause of this issue in Views can be addressed.