If you want to add your own submit button besides "Preview" and "Submit" in node-types form, you normally think you will form_alter and add your button with let's say a weight of 1000 so it sinks. But no, node.module uses theme_node_form() to custom theme this form, so _whatever_ you do, it will render your buttons somewhere that you can't control using weights.

Support from Acquia helps fund testing for Drupal Acquia logo

Comments

AmrMostafa’s picture

Assigned: Unassigned » AmrMostafa
Status: Active » Needs review
FileSize
1.66 KB

This is a a simple solution to for this simple problem. Very similar to this snipper which is already in node_filter_form():

  $form['filters']['buttons']['submit'] = array('#type' => 'submit', '#value' => (count($session) ? t('Refine') : t('Filter')));
  if (count($session)) {
    $form['filters']['buttons']['undo'] = array('#type' => 'submit', '#value' => t('Undo'));
    $form['filters']['buttons']['reset'] = array('#type' => 'submit', '#value' => t('Reset'));
  }
...
..
  $output .= '<div class="container-inline" id="node-admin-buttons">'. drupal_render($form['buttons']) .'</div>';
moshe weitzman’s picture

Title: Allow adding submit buttons to node-type forms » Allow adding submit buttons to node add/edit form
Status: Needs review » Reviewed & tested by the community
FileSize
1.76 KB

I wish I had looked here before redoing this patch. Anyway, here is a refreshed version. Works as advertised.

Gábor Hojtsy’s picture

Status: Reviewed & tested by the community » Fixed

Simple, straightforward, and with previous practice, so committed.

Anonymous’s picture

Status: Fixed » Closed (fixed)
samo’s picture

Was this mod only applied to 6.x?

Gábor Hojtsy’s picture

It would break backward compatibility on the form, so no way to apply it to 5.x IMHO.