Remove class=“form-item” from Drupal forms

微笑、不失礼 提交于 2019-12-07 11:08:51

问题



Drupal automatically adds <div>'s and classes around form items. All form elements will have the attribute class = "form-item". How do I override this default behavior?


回答1:


If you insist on changing it, it's added in the theme_form_element function. You can override it by copying that function to your theme's template.php file and renaming it THEMENAME_form_element (substituting the name of your theme in place of "THEMENAME") or phptemplate_form_element and removing the part that adds the class.




回答2:


In real experience these are useful classes, but if you want to extremely clear form you can theme each form element or theme form:
Much closer to your task i found here (not only zen theme and not only for user login block): Custom User Login Block on Drupal 6 Zen sub-themes in "Advanced theming" part, see bottom code.



来源:https://stackoverflow.com/questions/5012870/remove-class-form-item-from-drupal-forms

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!