You are here

function flag_confirm_submit in Flag 6.2

Same name and namespace in other branches
  1. 5 flag.module \flag_confirm_submit()
  2. 6 flag.module \flag_confirm_submit()
  3. 7.3 includes/flag.pages.inc \flag_confirm_submit()
  4. 7.2 flag.module \flag_confirm_submit()

Submit handler for the flag confirm form.

Note that validating whether the user may perform the action is done here, rather than in a form validation handler.

See also

flag_confirm()

File

./flag.module, line 719
The Flag module.

Code

function flag_confirm_submit(&$form, &$form_state) {
  $action = $form_state['values']['action'];
  $flag_name = $form_state['values']['flag_name'];
  $content_id = $form_state['values']['content_id'];
  $result = flag($action, $flag_name, $content_id);
  if (!$result) {
    drupal_set_message(t('You are not allowed to flag, or unflag, this content.'));
  }
  else {
    $flag = flag_get_flag($flag_name);
    drupal_set_message($flag
      ->get_label($action . '_message', $content_id));
  }
}