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.
How to produce the bug:
Register a template for a *_node_form in the theme hook_theme()
e.g.
mytheme_theme() {
return array(
'poll_node_form' => array(
'template' => 'poll-node-form',
'arguments' => array('form' => NULL),
),
);
}
Expected behaviour:
Theme system should recognize this newly registered form theming.
What happens instead:
drupal_render_form sees that node_form has specified #theme - and doesn't bother to check if any module or theme has registered its own theme for that form.
from drupal_render_form
// Don't override #theme if someone already set it.
Solution:
Remove the #theme item from the node_form form.
Comment | File | Size | Author |
---|---|---|---|
#3 | node.pages_.inc2_.patch | 518 bytes | andremolnar |
node.pages_.inc__0.patch | 452 bytes | andremolnar | |
Comments
Comment #1
andremolnar CreditAttribution: andremolnar commentedjust changing title to better describe the actual bug
Comment #2
dvessel CreditAttribution: dvessel commentedWe chatted about this in IRC and there are other problems with removing '#theme'. Like the inability to override the default node_form.
Comment #3
andremolnar CreditAttribution: andremolnar commentedAs per IRC conversation:
merlinofchaos points out that passing an array in #theme makes more sense - and solves the problem dvessel points out
Comment #4
andremolnar CreditAttribution: andremolnar commentedstatus change
Comment #5
chx CreditAttribution: chx commentedVery nice little patch, demonstrates the power of Drupal 6 and solves a regression.
Comment #6
dvessel CreditAttribution: dvessel commentedYeah, works as expected.
A followup patch to register them would help too. But it may start looking dirty inside node_theme().
Comment #7
Gábor HojtsyOK, committed, thanks.
Comment #8
(not verified) CreditAttribution: commentedAutomatically closed -- issue fixed for two weeks with no activity.