Bug #23628 See Comments

entry_save_and_close_redirect does not pass in original redirect url

Version: 4.3.1 Reporter: obfuscode

Affects all of EE 4.x

If you’re using the entry_save_and_close_redirect conditionally (Structure only redirects for Structure Managed channels depending on the settings), EE does not provide the URL it was originally going to redirect to and does not validate you are passing back an instance of CP\URL so if you don’t need to redirect the user elsewhere and return false or null, the CP dies out on a white page.

I found the hook call in AbstractPublish and copied the CP\URL code to generate the same URL but if that ever changes, our add-on may redirect incorrectly. Can you pass the original intended destination as another function param and test that what’s returned is a CP\URL instance?

  • Sounds reasonable, but is not a bug, the hook is working properly. As a member of the Developer Preview, it would be best for development-related feature requests to be posted to the Developer Preview forum. Thanks!

    Derek Jones
    05th June, 2018 at 4:16pm
  • I’d argue it is a bug. I can see how it could be considered a feature but most of the other hooks (channel entries, publish live preview route, etc) pass the value they expect back so if you’re not modifying the data, you just return the passed value.

    Because the save and redirect hook doesn’t pass a value, we added the code ee('CP/URL')->make('publish/edit/', array('filter_by_channel' => $entry->channel_id)); to create the original URL. That works currently but if the EE CP paths change, that code breaks the CP because that hook is always called if present and EE uses the value returned without checking it.

    obfuscode
    06th June, 2018 at 8:13am
  • Is it documented that the URL you are wanting will be available to you in that hook? Is there something about the hook as-documented that is not working? Is the documented $entry value not provided?

    Sorry to push back on this, but it’s best for both you the developer that wants a change to get made as well as us to manage our workload. Bugs are actual defects in the software. This is working as intended, and by many add-ons; most that are redirecting only need to know the details about the entry and don’t care where the native software was going to take the user.

    Bugs get triaged, treated, and released very differently from additive features and changes. I agree with you that this would be a useful addition, I’m just trying to help you to see where and how it is most effective to get those changes made. Leaving the bug tracker for actual defects only is a win-win for both of us.

    Derek Jones
    06th June, 2018 at 11:32am

You must be signed in to comment on a bug report.

ExpressionEngine News

#eecms, #events, #releases