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.

Support from Acquia helps fund testing for Drupal Acquia logo

Comments

acbramley’s picture

Status: Active » Needs review
Lang Wu Jane’s picture

This 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.

Steven Jones’s picture

Status: Needs review » Fixed

Awesome, thanks!

  • Steven Jones committed fa0aca9 on 7.x-3.x authored by acbramley
    Issue #2222617 by acbramley: Fixed Return url config not used if display...

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.