You are here

function flag_confirm in Flag 7.2

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

Form for confirming the (un)flagging of a piece of content.

Parameters

$action: Either 'flag' or 'unflag'.

$flag: A loaded flag object.

$content_id: The id of the content to operate on. The type is implicit in the flag.

See also

flag_confirm_submit()

1 string reference to 'flag_confirm'
flag_menu in ./flag.module
Implements hook_menu().

File

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

Code

function flag_confirm($form, &$form_state, $action, $flag, $content_id) {
  $form['action'] = array(
    '#type' => 'value',
    '#value' => $action,
  );
  $form['flag_name'] = array(
    '#type' => 'value',
    '#value' => $flag->name,
  );
  $form['content_id'] = array(
    '#type' => 'value',
    '#value' => $content_id,
  );
  $question = $flag
    ->get_label($action . '_confirmation', $content_id);
  $path = isset($_GET['destination']) ? $_GET['destination'] : '<front>';
  $yes = $flag
    ->get_label($action . '_short', $content_id);
  return confirm_form($form, $question, $path, '', $yes);
}