function hook_flag_javascript_info_alter in Flag 7.3
Same name and namespace in other branches
- 6.2 flag.api.php \hook_flag_javascript_info_alter()
- 7.2 flag.api.php \hook_flag_javascript_info_alter()
Alter the javascript structure that describes the flag operation.
Parameters
array $info: The info array before it is returned from flag_build_javascript_info().
flag_flag $flag: The full flag object.
See also
1 invocation of hook_flag_javascript_info_alter()
- flag_build_javascript_info in includes/
flag.pages.inc - Builds the JavaScript structure describing the flagging operation.
File
- ./
flag.api.php, line 374 - Hooks provided by the Flag module.
Code
function hook_flag_javascript_info_alter(&$info, $flag) {
if ($flag->name === 'test') {
$info['newLink'] = $flag
->theme($flag
->is_flagged($info['contentId']) ? 'unflag' : 'flag', $info['contentId'], array(
'after_flagging' => TRUE,
'errors' => $flag
->get_errors(),
// Additional options to pass to theme's preprocess function/template.
'icon' => TRUE,
'hide_text' => TRUE,
));
}
}