The patch is very simple but opens a lot of possibilites. Like you can put the output of any Drupal function into a block. Another step towards multi region pages.

This patch does not even break backwards compatibility: if you do not want to print anything or want to handle your output, fine, return nothing from the callback as you do now. However, you do not need to write print theme('page', ...); anymore, just return it, Drupal will theme it for you.

I'm posting two patches. The first is the very simple, functional one.

The second, however is just the result of a preg change.

Support from Acquia helps fund testing for Drupal Acquia logo

Comments

chx’s picture

FileSize
36.85 KB

here comes the dull megapatch. Note: contact.module had a bug, it called theme_page with two parameters.

adrian’s picture

I'm gonna put a definate +1 for this.

Even just for consistency sake, it's a wonderful patch.

chx’s picture

FileSize
0 bytes

Removed four instances of return; preceded by a return $output.

chx’s picture

FileSize
36.97 KB

0 bytes? reattach.

dikini’s picture

+1 makes it easier to understand what is going on

moshe weitzman’s picture

+1. makes it easier to reuse the output of functions. The print statement at the end of many callback functions hinders reuse.

Stefan Nagtegaal’s picture

I like this! Very nice and very clean patch... +1 from me either...

chx’s picture

FileSize
37.61 KB

I deleted system_admin_page. There is no need for it, and it broke the return chain.

chx’s picture

FileSize
37.58 KB

This gets better and better. Turns out (thanks Steven and Morbus) that watchdog_overview takes no parameter. So, a few bytes are shaved off.

chx’s picture

FileSize
39.6 KB

Rerolled the two patches into one.

Dries’s picture

Committed to HEAD.

asimmonds’s picture

FileSize
441 bytes

There's a print that has been missed in user_page() for user_view()'s output.

Steven’s picture

Fixed in HEAD. The 4.6 version of that line in fact contained that print statement too, but it was useless there because user_view() didn't return anything. I got rid of it in 4.6.

walkah’s picture

FileSize
690 bytes

um... looks like blog.module was broken too.... don't you people test these things? ;)

patch attached. (restoring blog/3 , blog/walkah, etc urls).

chx’s picture

FileSize
1.15 KB

I test continously.

Steven’s picture

Applied to HEAD.

Anonymous’s picture