Forms API won't call theme functions if theme_ doesn't exist.
merlinofchaos - December 22, 2005 - 19:19
| Project: | Drupal |
| Component: | forms system |
| Category: | bug report |
| Priority: | normal |
| Assigned: | Unassigned |
| Status: | closed |
Description
In the forms API, all forms are supposed to be themeable.
However, forms.inc checks to see if a theme_ function exists for a given formid; if it doesn't, it never calls a specific themed function.
The answer is to create a new theme function, which I called 'theme_get_function' which is mostly the code from theme(). It checks for a theme function and, if it finds it, returns it; otherwise it returns false.
theme() then just calls that and executes the function it returns, if one was found.
Patch attached.
| Attachment | Size | Status | Test result | Operations |
|---|---|---|---|---|
| theme_get_function.patch | 1.61 KB | Ignored | None | None |

#1
Rerolled.
#2
#3
New patch has better doxy, but should be same otherwise.
#4
Ugh cvs diff hates me
#5
Not sure I like this patch. Has this been benchmarked?
#6
After fiddling with xdebug:
The call added 15ms in 161 calls to theme() on my server (testing just the front page, which had 10 nodes on it, plus some blocks, etc). My server runs slow, too, and was taking 1200ms to run the entire page.
#7
Committed to HEAD. Thanks.
#8