So, I've implemented hook_form_alter in a custom module. I have added a button to the node edit form of a specific content type.
However, I can't for the life of me get the new button to display with the standard buttons ie save & preview. It just appears at the top of the page, regardless of the figure that i put in as the weight (I tried 100000000000000)... Fingers crossed that this is just a 'newbie' oversight :)
Here is the code that I'm using:
function MYMODULE_form_alter(&$form, $form_state, $form_id) {
if($form_id == 'CONTENTTYPE_node_form') {
// Add validation for a file
$form['field_CUSTOMFILE'][0]['#upload_validators']['custom_file_validation'] = array();
// Add update site button to CONTENTYPE node add/edit form
$form['actions']['update_site'] = array(
'#type' => 'submit',
'#value' => 'Update site',
'#name' => 'op',
'#submit' => array('MYMODULE_form_submit'), /* NEED this */
'#weight' => 99,
);
$form['actions']['submit']['#weight'] = 101;
$form['actions']['preview']['#weight'] = 100;
return $form;
}
}
These lines from above were only added today but made no difference...
$form['actions']['submit']['#weight'] = 101;
$form['actions']['preview']['#weight'] = 100;
As always, anyway pointers would be very much appreciated :)
Edit:
This question was not answered in the indicated "This question has already a answer" link above... That link explains Drupal 7 specific code, although the post isn't tagged as such... This post was specific to Drupal 6 as tagged... In fact the code in this post didn't work for me because it was using Drupal 7 code :)