我的模块(mymodule)中有一个表单...
function mymodule_form()
{
$form['mytext'] = array(
'#title' => 'Password',
'#type' => 'password',
'#size' => 10,
);
$form['submit'] = array(
'#type' => 'submit',
'#value' => 'Cool!',
);
$form['cool_submit'] = array(
'#type' => 'submit',
'#value' => 'Cool Submit!',
);
return $form;
}
我使用 hook_entity_view 钩子在所有显示的 drupal 实体下显示此表单。
function mymodule_entity_view($entity, $type, $view_mode, $langcode) {
$entity->content['myadditionalfield'] = mymodule_form();
}
显示此表单时,drupal 会自行将 DIV 标记添加到 mytext(密码字段)。我想覆盖它并为此表单提供我自己的 DIV 标签和主题。我该怎么做?
谢谢 :-)