function top_buttons_form_alter in Util 6.3
Same name and namespace in other branches
- 7 contribs/top_buttons/top_buttons.module \top_buttons_form_alter()
Implements hook_form_alter(). Duplicate the buttons on the node edit form.
File
- contribs/
top_buttons/ top_buttons.module, line 12 - Duplicate node form buttons at the top.
Code
function top_buttons_form_alter(&$form, $form_state, $form_id) {
// Is it a node add/edit form?
if (drupal_substr($form_id, -10) == '_node_form') {
$node_type = drupal_substr($form_id, 0, -10);
$handle_types = variable_get('top_buttons_types', array());
if (variable_get("top_buttons_{$node_type}", 1)) {
$form['body_field']['buttons'] = $form['buttons'];
$form['body_field']['buttons']['#weight'] = -5;
return;
}
}
else {
// Is it the node type add/edit form?
if ($form_id == 'node_type_form') {
$node_type = $form['#node_type']->type;
$form['submission']["top_buttons"] = array(
'#type' => 'radios',
'#options' => array(
t('No'),
t('Yes'),
),
'#title' => t('Duplicate submission buttons at top'),
'#description' => t('Select "yes" if you want the submission buttons ("Save," "Delete," etc.) duplicated above the body field.'),
'#attributes' => array(
'class' => 'container-inline',
),
'#default_value' => variable_get("top_buttons_{$node_type}", 1),
);
return;
}
}
}