You are here

function flag_confirm in Flag 6.2

Same name and namespace in other branches
  1. 5 flag.module \flag_confirm()
  2. 6 flag.module \flag_confirm()
  3. 7.3 includes/flag.pages.inc \flag_confirm()
  4. 7.2 flag.module \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
Implementation of hook_menu().

File

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

Code

function flag_confirm(&$form_state, $action, $flag, $content_id) {
  $form = array();
  $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);
}