欢迎各位兄弟 发布技术文章

这里的技术是共享的

You are here

drupal 单个字段 form textfield remove form-item div 移除 文本框外围的form-item的div Removing field wrapper in a form 这个方法 好像不行


I would like to theme a form, and the div wrapping my text input element prevents me from doing what i want. So i got this right now :
<div class="form-item form-type-textfield form-item-email">

 <input type="text" id="edit-email" name="email" value="mail@msn.com" size="20" maxlength="128" class="form-text required">
</div>
</div>
I would like to have this :

<input type="text" id="edit-email" name="email" value="mail@msn.com" size="20" maxlength="128" class="form-text required">

正确答案 这个方法好像不行
You can set #theme_wrappers of the element to empty array so the element will not have any wrapper at all.
$form['email']['#theme_wrappers'] = array();

来自  http://drupal.stackexchange.com/questions/146746/removing-field-wrapper-in-a-form
普通分类: