Download & Extend

Forms API won't call theme functions if theme_ doesn't exist.

Project:Drupal core
Component:forms system
Category:bug report
Priority:normal
Assigned:Unassigned
Status:closed (fixed)

Issue Summary

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.

AttachmentSizeStatusTest resultOperations
theme_get_function.patch1.61 KBIgnored: Check issue status.NoneNone

Comments

#1

Rerolled.

AttachmentSizeStatusTest resultOperations
theme_get_function_0.patch1.93 KBIgnored: Check issue status.NoneNone

#2

Status:needs review» reviewed & tested by the community

#3

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

AttachmentSizeStatusTest resultOperations
theme_get_function2.patch2.57 KBIgnored: Check issue status.NoneNone

#4

Ugh cvs diff hates me

AttachmentSizeStatusTest resultOperations
theme_get_function2_0.patch2.39 KBIgnored: Check issue status.NoneNone

#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

Status:reviewed & tested by the community» fixed

Committed to HEAD. Thanks.

#8

Status:fixed» closed (fixed)
nobody click here