function flag_actions_form_submit in Flag 5
Same name and namespace in other branches
- 6.2 flag_actions.module \flag_actions_form_submit()
- 6 flag_actions.module \flag_actions_form_submit()
- 7.3 flag_actions.module \flag_actions_form_submit()
- 7.2 flag_actions.module \flag_actions_form_submit()
Generic submit handler for saving flag actions.
File
- ./
flag_actions.module, line 436 - Actions support for the Flag module.
Code
function flag_actions_form_submit($form_id, $form_values) {
// This is a multistep form. If selecting an action, do not yet process.
if ($_POST['op'] == t('Continue')) {
return;
}
$aid = $form_values['flag']['aid'];
$flag = $form_values['flag']['flag'];
$event = $form_values['flag']['event'];
$threshold = $form_values['flag']['threshold'];
$callback = $form_values['flag']['callback'];
$parameters = $form_values;
unset($parameters['flag']);
if (empty($aid)) {
$aid = flag_actions_insert_action($flag->fid, $event, $threshold, $callback, $parameters);
$form_values['flag']['aid'] = $aid;
$form_values['flag']['is_new'] = TRUE;
}
else {
flag_actions_update_action($aid, $event, $threshold, $parameters);
}
$action = flag_actions_get_action($aid);
drupal_set_message(t('The "@action" action for the @title flag has been saved.', array(
'@action' => $action->description,
'@title' => $flag
->get_title(),
)));
return 'admin/build/flags/actions';
}