Support for Drupal 7 is ending on 5 January 2025—it’s time to migrate to Drupal 10! Learn about the many benefits of Drupal 10 and find migration tools in our resource center.
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.
Comment | File | Size | Author |
---|---|---|---|
#15 | print2.patch | 1.15 KB | chx |
#14 | blog-print-theme.patch | 690 bytes | walkah |
#12 | user_1_0.patch | 441 bytes | asimmonds |
#10 | output_0.patch | 39.6 KB | chx |
#9 | output1_3.patch | 37.58 KB | chx |
Comments
Comment #1
chx CreditAttribution: chx commentedhere comes the dull megapatch. Note: contact.module had a bug, it called theme_page with two parameters.
Comment #2
adrian CreditAttribution: adrian commentedI'm gonna put a definate +1 for this.
Even just for consistency sake, it's a wonderful patch.
Comment #3
chx CreditAttribution: chx commentedRemoved four instances of return; preceded by a return $output.
Comment #4
chx CreditAttribution: chx commented0 bytes? reattach.
Comment #5
dikini CreditAttribution: dikini commented+1 makes it easier to understand what is going on
Comment #6
moshe weitzman CreditAttribution: moshe weitzman commented+1. makes it easier to reuse the output of functions. The print statement at the end of many callback functions hinders reuse.
Comment #7
Stefan Nagtegaal CreditAttribution: Stefan Nagtegaal commentedI like this! Very nice and very clean patch... +1 from me either...
Comment #8
chx CreditAttribution: chx commentedI deleted
system_admin_page
. There is no need for it, and it broke the return chain.Comment #9
chx CreditAttribution: chx commentedThis gets better and better. Turns out (thanks Steven and Morbus) that watchdog_overview takes no parameter. So, a few bytes are shaved off.
Comment #10
chx CreditAttribution: chx commentedRerolled the two patches into one.
Comment #11
Dries CreditAttribution: Dries commentedCommitted to HEAD.
Comment #12
asimmonds CreditAttribution: asimmonds commentedThere's a print that has been missed in user_page() for user_view()'s output.
Comment #13
Steven CreditAttribution: Steven commentedFixed 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.
Comment #14
walkah CreditAttribution: walkah commentedum... looks like blog.module was broken too.... don't you people test these things? ;)
patch attached. (restoring blog/3 , blog/walkah, etc urls).
Comment #15
chx CreditAttribution: chx commentedI test continously.
Comment #16
Steven CreditAttribution: Steven commentedApplied to HEAD.
Comment #17
(not verified) CreditAttribution: commented