I need to change the submit and preview button order in the node edit form in Drupal 7. By default the submit button shows first the preview button, But I need vice versa.
How can I achieve this?
Drupal Answers is a question and answer site for Drupal developers and administrators. It only takes a minute to sign up.
Sign up to join this communityI need to change the submit and preview button order in the node edit form in Drupal 7. By default the submit button shows first the preview button, But I need vice versa.
How can I achieve this?
One solution is to use hook_form_alter()
in a custom module to make the submit button heavier than the preview button:
function MYMODULE_form_alter(&$form, &$form_state, $form_id) {
if($form_id == 'MYNODETYPE_node_form') {
$form['actions']['preview']['#weight'] = $form['actions']['submit']['#weight']-1;
}
}
Just change the module name and form id accordingly.