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.
The logic that sets the return-url query string only uses the configuration option set in the views display if the display is not attached:
// If we were attached to another view, grab that for the final URL.
if (!empty($_GET['attach']) && isset($this->view->display[$_GET['attach']])) {
// Get the path of the attached display:
$querystring['return-url'] = $this->view->get_url(NULL, $this->view->display[$_GET['attach']]->handler->get_path());
}
else {
$return_path = $this->get_option('return_path');
$querystring['return-url'] = isset($return_path) ? $return_path : NULL;
}
This means there's no way to set a custom return url AND attach the export to a display. Simply reversing the logic should do the trick. Patch attached, I've tested that $this->get_option('return_path') returns false when there is no return path set.
Comment | File | Size | Author |
---|---|---|---|
views-data-export-fix-return-path-logic.patch | 1.73 KB | acbramley | |
Comments
Comment #1
acbramley CreditAttribution: acbramley commentedComment #2
Lang Wu Jane CreditAttribution: Lang Wu Jane commentedThis patch is quite helpful to me!
I just need the configured return url working, because I need to attach export to a block display who will never has a view path. The result of that is, the views path will be the export display path.
Comment #3
Steven Jones CreditAttribution: Steven Jones commentedAwesome, thanks!