[drupal-devel] Page layout workflow mockup

Jonathan Chaffer jchaffer at structureinteractive.com
Mon Mar 21 18:40:36 UTC 2005

On Mar 21, 2005, at 12:01 PM, Steven Wittens wrote:

>> I have an idea which would help implementing this. There are a lot of 
>> functions in Drupal which ends with print theme('page', $output);
>> These shall be changed to return $output; and 
>> menu_execute_active_handler should be changed, too:
>> -  call_user_func_array($menu['items'][$mid]['callback'], $arguments);
>> -  return MENU_FOUND;
>> + return call_user_func_array($menu['items'][$mid]['callback'], 
>> $arguments);
>> and then index.php shall have a default clause to print theme('page', 
>> $status); -- well, let's rename $status to $return.
> Won't this mess up XML feeds or the printer-friendly book output?

I have similar concerns. These and some other examples of pages do not 
use theme('page'), so it must be possible for a menu callback to output 
without that wrapper. This can probably be managed with special-casing 
"return NULL;" to not pipe output through theme('page'), as suggested 
by Karoly.

To make this change, you also have to police the entire code base for 
the many uses of drupal_set_title(), menu_set_location(), etc. At the 
moment all menu callbacks can assume that they are in charge of the 
entire page, and many use the above functions and others which would be 
detrimental to using the output in other contexts.

One possible benefit of such a huge refactoring would be the ability to 
grab smaller pieces of a page outside of the page context somehow, for 
use in the Ajax stuff I'm playing with.
(If you're interested, play with the table sorting widgets at 

Jonathan Chaffer
Applications Developer, structure:interactive
(616) 364-7423    http://www.structureinteractive.com/

More information about the drupal-devel mailing list