function auto_nodetitle_form_alter in Automatic Nodetitles 7
Same name and namespace in other branches
- 5 auto_nodetitle.module \auto_nodetitle_form_alter()
- 6 auto_nodetitle.module \auto_nodetitle_form_alter()
Implements hook_form_alter() for the node form.
File
- ./
auto_nodetitle.module, line 28 - Allows hiding of the node title field and automatic title creation.
Code
function auto_nodetitle_form_alter(&$form, &$form_state, $form_id) {
if (isset($form['#node_edit_form']) && $form['#node_edit_form'] === TRUE) {
if (auto_nodetitle_get_setting($form['#node']->type) == AUTO_NODETITLE_ENABLED) {
// We will autogenerate the title later, just hide the title field in the
// meanwhile.
$form['title']['#value'] = 'ant';
$form['title']['#type'] = 'value';
$form['title']['#required'] = FALSE;
}
elseif (auto_nodetitle_get_setting($form['#node']->type) == AUTO_NODETITLE_OPTIONAL) {
$form['title']['#required'] = FALSE;
}
}
}