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.

Comments

chx’s picture

StatusFileSize
new1.93 KB

Rerolled.

chx’s picture

Status: Needs review » Reviewed & tested by the community
merlinofchaos’s picture

StatusFileSize
new2.57 KB

New patch has better doxy, but should be same otherwise.

merlinofchaos’s picture

StatusFileSize
new2.39 KB

Ugh cvs diff hates me

dries’s picture

Not sure I like this patch. Has this been benchmarked?

merlinofchaos’s picture

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.

dries’s picture

Status: Reviewed & tested by the community » Fixed

Committed to HEAD. Thanks.

raema’s picture

Status: Fixed » Closed (fixed)