Maybe this isn't the correct place to be doing this, but in trying to find the earliest possible place to detect a 404, I happened upon hook_page_delivery_callback_alter() from within drupal_delivery_page() in common.inc
This passes in the $delivery_callback so that it can be altered, but if we could also pass in the $page_callback_result, we could detect if we're going to be showing a 404 page (the value being (int) 2) and we could also completely hijack this as well, showing something completely different than a 404.
Why would you want to do this? Well, I'm trying to come up with a module that will instead show a node creation form instead of a 404 page. This is a fairly common wiki practice. If you create a link to a wiki page that doesn't yet exists, you are prompted to create that page.
Again, maybe this is the wrong place to do this, but it would be really convenient.
| Comment | File | Size | Author |
|---|---|---|---|
| #2 | pass-page-callback-result-897504-2.patch | 2.51 KB | devin carlson |
| common.inc-alter.patch | 846 bytes | sirkitree |
Comments
Comment #1
chromix commentedSeems kind of unnecessary since you could just do something like this:
The boost module does something similar if you're looking for a better example.
Comment #2
devin carlson commentedThis would be useful for the Dialog module.