As seen in taxonomy.module, _taxonomy_term_select returns a form element with a #type of 'select' and a #theme value of 'taxonomy_term_select'. However, despite my best efforts, I have found it impossible to theme the taxonomy term selection drop down list without retheming theme_select.
After a bit of debugging, I discovered theme('taxonomy_term_select', $element) is called, but its output is ignored and theme('select') is used instead, even if the default theme_taxonomy_term_select function (which simply calls theme('select', $element)) is overridden.
I have a feeling this may be a bug in the new Form API's form_render function, but I could be wrong. Let me know if more information is needed to resolve this bug, I would love to see it fixed for the 4.7 release.
Comment | File | Size | Author |
---|---|---|---|
#15 | form_comment.patch | 900 bytes | Zen |
#9 | drat.patch | 940 bytes | chx |
#6 | theme_wo_children_0.patch | 1.64 KB | chx |
#4 | theme_wo_children.patch | 671 bytes | chx |
#1 | drupal-60797.patch | 571 bytes | speakout_tom |
Comments
Comment #1
speakout_tom CreditAttribution: speakout_tom commentedFixed using 'markup' instead of 'select' for the #type attribute of the element returned by _taxonomy_term_select. Patch attached.
Comment #2
adrian CreditAttribution: adrian commentedIt might look correct with that patch, but there's no way we could validate against it.
How are you trying to theme it ?
Have you tried using form_alter and using the '#theme' property ?
Comment #3
chx CreditAttribution: chx commentedAdrian, the problem is something like that #theme callbacks render children but the actual element is still rendered by the element renderer. What we need here is that if the children are empty but there is content then we should not call the element renderer.
Comment #4
chx CreditAttribution: chx commentedSomething like this...
Comment #5
adrian CreditAttribution: adrian commentedI think chx' solution is correct for this.
Comment #6
chx CreditAttribution: chx commentedComment #7
Gerhard Killesreiter CreditAttribution: Gerhard Killesreiter commentedapplied
Comment #8
Zen CreditAttribution: Zen commentednode edit form: Associated terms are no longer being preselected.
-K
Comment #9
chx CreditAttribution: chx commentedOf course not when #value is overwritten! I forgot the last change here.
Comment #10
webchickConfirmed existence of problem, and chx's patch does indeed fix it.
I then went through and did my "click around to every bloody form I can think of" test -- created new account, logged in, messed w/ taxonomy, access control, etc. -- all looks good! RTBC.
Comment #11
webchickahem. :P
Comment #12
Zen CreditAttribution: Zen commentedPatch fixes issue. Shouldn't the comment be moved up as well?
Setting to Comment needs work.
Thanks,
-K
Comment #13
dopry CreditAttribution: dopry commentedNo the comment belongs to another code block, and shouldn't be moved.
Comment #14
killes@www.drop.org CreditAttribution: killes@www.drop.org commentedapplied to 4.7 branch
Comment #15
Zen CreditAttribution: Zen commentedAnd the comment moved to the correct location.
-K
Comment #16
killes@www.drop.org CreditAttribution: killes@www.drop.org commentedapplied to 4.7 branch
Comment #17
dmitrig01 CreditAttribution: dmitrig01 commentedComment #18
dwwfor the interested reader, drumm also applied this to head as revision 1.114. so yes, it truly is fixed on both branches.
Comment #19
(not verified) CreditAttribution: commented