You are here

function flag_node_action in Flag 7.2

Same name and namespace in other branches
  1. 6.2 includes/flag.actions.inc \flag_node_action()
  2. 7.3 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 108
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);
  }
}