You are here

function flag_build_javascript_info in Flag 6.2

Same name and namespace in other branches
  1. 7.3 includes/flag.pages.inc \flag_build_javascript_info()
  2. 7.2 flag.module \flag_build_javascript_info()

Builds the JavaScript structure describing the flagging operation.

1 call to flag_build_javascript_info()
flag_page in ./flag.module
Menu callback for (un)flagging a node.

File

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

Code

function flag_build_javascript_info($flag, $content_id) {
  $info = array(
    'status' => TRUE,
    'newLink' => $flag
      ->theme($flag
      ->is_flagged($content_id) ? 'unflag' : 'flag', $content_id, TRUE),
    // Further information for the benefit of custom JavaScript event handlers:
    'contentId' => $content_id,
    'contentType' => $flag->content_type,
    'flagName' => $flag->name,
    'flagStatus' => $flag
      ->is_flagged($content_id) ? 'flagged' : 'unflagged',
  );
  drupal_alter('flag_javascript_info', $info);
  return $info;
}