Download & Extend

Allow adding submit buttons to node add/edit form

Project:Drupal core
Version:6.x-dev
Component:node.module
Category:feature request
Priority:normal
Assigned:AmrMostafa
Status:closed (fixed)

Issue Summary

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.

Comments

#1

Assigned to:Anonymous» AmrMostafa
Status:active» needs review

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>';
AttachmentSizeStatusTest resultOperations
node_submit_buttons.patch1.66 KBIgnored: Check issue status.NoneNone

#2

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

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

AttachmentSizeStatusTest resultOperations
mw_50.patch1.76 KBIgnored: Check issue status.NoneNone

#3

Status:reviewed & tested by the community» fixed

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

#4

Status:fixed» closed (fixed)

#5

Was this mod only applied to 6.x?

#6

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