I needed to add a second submit handler to the batch update form.

I see in the batch form definition, you can define

'#submit' => 'custom_submit_handler',

However, that handler is only called if the domain_action is set to 'custom'

I needed to use both domain_conf as the handler and add a separate submit handler to do additional processing.

I ended up using the form_alter snippet below:

<?php
/**
 * Implementation of hook_form_FORMID_alter
 */
function example_module_form_domain_batch_form_alter($form, &$form_state) {
  // if custom handler set, let it handle the submit.
  if( $form['handler']['#value'] == 'custom' ){
    return;
  }elseif( isset($form['submit_handler']) && function_exists($form['submit_handler']['#value']) ){
    // add second submit handler, if present
    $form['#submit'][] = $form['submit_handler']['#value'];
  }
}
?>

That way domain_conf ( or the configured handler ) can handle saving the settings and then pass control onto another custom submit handler. If the handler is already set to custom, the domain module will add the submit_handler itself.

hth,

DT

Comments

agentrickard’s picture

There was a reason I had to code it this way, but I forget what it was...and it might be a limitation from D5.

I think the idea was that you would never need to do this (or that hook_form_alter() is the proper way.) This #submit is there if you want to bypass the normal save mechanisms.

agentrickard’s picture

Version: 6.x-2.1 » 7.x-2.x-dev
Status: Active » Postponed

API change. Postponed.

agentrickard’s picture

Version: 7.x-2.x-dev » 7.x-3.x-dev
Status: Postponed » Active