You are here

function flag_node_action in Flag 6.2

Same name and namespace in other branches
  1. 7.3 includes/flag.actions.inc \flag_node_action()
  2. 7.2 includes/flag.actions.inc \flag_node_action()

Implements Drupal action. Flags a node.

Note the first parameter is "object" because it may be a comment or a node.

File

includes/flag.actions.inc, line 107
Hooks for flag actions.

Code

function flag_node_action(&$object, $context = array()) {
  if ($flag = flag_get_flag($context['flag_action']['flag'])) {
    $account = isset($context['account']) ? $context['account'] : $GLOBALS['user'];
    $flag
      ->flag($context['flag_action']['op'], $object->nid, $account, TRUE);
  }
}