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.

CommentFileSizeAuthor
#4 patch_1172.27 KBmoshe weitzman
patch_1112.27 KBmoshe weitzman

Comments

eaton’s picture

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

drumm’s picture

Status: Needs review » Needs work

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

chx’s picture

use !== NULL if you do not like isset(). is_null is dog slow.

moshe weitzman’s picture

Status: Needs work » Needs review
StatusFileSize
new2.27 KB

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

moshe weitzman’s picture

Status: Needs review » Reviewed & tested by the community

i implemented the minor changes suggested by 2 reviewers, so i promote

moshe weitzman’s picture

Version: x.y.z » 6.x-dev
ChrisKennedy’s picture

Status: Reviewed & tested by the community » Needs work

Is this still relevant?

moshe weitzman’s picture

Version: 6.x-dev » 7.x-dev

yes, it still needed. we'll hopefull get this into 7.

moshe weitzman’s picture

Status: Needs work » Closed (fixed)

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