function autodialog_asaf_form_ajax_commands_alter in Auto-Dialog 7
Implements hook_asaf_form_ajax_commands_alter().
File
- ./
autodialog.module, line 124
Code
function autodialog_asaf_form_ajax_commands_alter(&$commands, $form, $form_state, $form_id) {
// Disable redirect and reload
if (!empty($form['#autodialog_options']['ajaxDisableRedirect'])) {
$disabled = FALSE;
foreach ($commands as $key => $command) {
if ($command['command'] == 'asafRedirect' || $command['command'] == 'asafReload') {
unset($commands[$key]);
$disabled = TRUE;
break;
}
}
if ($disabled) {
foreach ($commands as $key => $command) {
// Search command adds status messages
if ($command['command'] == 'insert' && $command['method'] == 'prepend' && !$command['selector']) {
$commands[$key]['method'] = 'html';
if ($commands[$key]['data'] == '') {
$commands[$key]['data'] = t('Form submitted.');
}
}
}
}
}
}