We recently added a second param, '$show_blocks', to theme_page() which can be used to disable all blocks. The problem though is that the theme('page') call is almost always hard coded into index.php without that param. This patch allows menu callbacks to pass back an array which contains a value for this second param.
While documenting menu_execute_active_handler(), I realized that it could be cleaned up a bit by accepting a $path. That param can be used by panels.module and others to programmatically retrieve the contents of a given drupal path.
Documentation is in the patch.
| Comment | File | Size | Author |
|---|---|---|---|
| #4 | patch_117 | 2.27 KB | moshe weitzman |
| patch_111 | 2.27 KB | moshe weitzman |
Comments
Comment #1
eaton commentedNeed to test the code more thoroughly, but a big +1 for the concept. This is *also* very useful for scenerios where page-content-areas are refreshed one by one via AHAH methods. With jQuery (hopefully!) going in, it'll set us up nicely for re-use of various callbacks without major recoding.
Comment #2
drummThere is some weird indentation towards the end.
Can this be posted in two separate patches?
How would the code handle the default case of $path == NULL? Would an empty string for the home page be better?
It seems like this should be something set in hook_menu() rather than the page return value.
Comment #3
chx commenteduse
!== NULLif you do not like isset(). is_null is dog slow.Comment #4
moshe weitzman commentedthanks for the reviews. reroll with these changes:
- fixed indentation
- using '' as default for $path
- using !== NULL
i don't think this can be moved to hook_menu. the thing that needs to be fixed is the return value after *executing the callback*. is not much related to hook_menu definition. executing the callaback happens in menu_execute_active_handler() so thats where my code lives. i'm happy to move this though, if someone sees a better way.
ideally this is 2 separate patches. however, they would collide because they both would need to PHPDoc the same function. I would have to pick one to be dependant and get twice as many reviews so i beg for mercy on this. i will do it if required though.
Comment #5
moshe weitzman commentedi implemented the minor changes suggested by 2 reviewers, so i promote
Comment #6
moshe weitzman commentedComment #7
ChrisKennedy commentedIs this still relevant?
Comment #8
moshe weitzman commentedyes, it still needed. we'll hopefull get this into 7.
Comment #9
moshe weitzman commentedmenu_execute_active_handler() now accepts a $path param but we still have no solution to the letting a callback disable blocks. the solution here is not quite flexible enough. we are having a related problem with the popups patch. need thought. i think we can close this for now.