如何将自定义配置区域添加到节点编辑表单正下方创作信息 & 发布选项部分?
您可以使用hook_form_FORM_ID_alter() http://api.drupal.org/api/drupal/modules%21system%21system.api.php/function/hook_form_FORM_ID_alter/7。
下面的例子:
function my_module_form_node_form_alter(&$form, $form_state) {
// if you are targeting a specific content type then
// you can access the type:
$type = $form['#node']->type;
// Then
if ($type == 'my_content_type') {
// use a contact settings for the sake of this example
$form['contact'] = array(
'#type' => 'fieldset',
'#title' => t('Contact settings'),
'#weight' => 100,
'#collapsible' => TRUE,
'#collapsed' => FALSE,
);
// add simple checkbox to the field set
$form['contact']['approve'] = array(
'#type' =>'checkbox',
'#title' => t('Contact me'),
);
}
}
现在用于存储数据我鼓励你看看examples http://drupal.org/project/examples项目;它有许多代码示例和大量文档。
另外,检查表单 API http://api.drupal.org/api/drupal/developer!topics!forms_api_reference.html/有关不同类型表单元素的更多信息。
希望这可以帮助。
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)