When using the submit_new_entry_redirect hook you are unable to properly use this hook.
The hook calling code is:
$loc = $EXT->call_extension('submit_new_entry_redirect', $entry_id, $data, $cp_call);
$cp_call is nice to know if you are in the CP or not but without access to $return_url, which is the return url set by custom forms, you are unable to only affect the CP calls and you are unable to do any logic on $return_url.
To properly use this hook developers need the same data that EE core uses to decide where to redirect.
For example, if you only want to redirect CP posts to a certain CP page and just let all custom forms redirect as normal, you can not do this because $loc is auto set with the return value and we do not have access to $return_url.
Another example would be if you wanted to do logic on the $return_url value to change the redirect according to certain conditions in the url.
We can not get return_url from POST either because it is unset before the hook call on line 3282 of cp.publish.php.
Having the $loc variable passed to the hook would be nice as well. This way you wouldn’t have to reproduce the same logic EE just did to get the location so you can easily pass it back as a default value or perform logic on it.
