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
Comment #1
agentrickardThere 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.
Comment #2
agentrickardAPI change. Postponed.
Comment #3
agentrickardComment #4
dqdI'll close this issue due to inactivity for 12 years and upcoming EOL of Drupal 7 in January 2025. While the project's version for Drupal 7 will surely keep providing support for security issues and website breaking bug fixes for Drupal 7, we should try to minimize the open issues for Drupal 7 in the queue as much as possible. A big thanks around for the report and all the efforts in here. Feel free to re-open if you can provide a fix or found an additional related problem which increases the issue priority.