function flag_flag_link in Flag 6
Same name and namespace in other branches
- 5 flag.module \flag_flag_link()
- 6.2 flag.module \flag_flag_link()
- 7.3 flag.module \flag_flag_link()
- 7.2 flag.module \flag_flag_link()
Implementation of hook_flag_link().
When Flag uses a link type provided by this module, it will call this implementation of hook_flag_link(). It returns a single link's attributes, using the same structure as hook_link(). Note that "title" is provided by the Flag configuration if not specified here.
Parameters
$flag: The full flag object of for the flag link being generated.
$action: The action this link will perform. Either 'flag' or 'unflag'.
$content_id: The ID of the node, comment, user, or other object being flagged.
Return value
An array defining properties of the link.
File
- ./
flag.module, line 199
Code
function flag_flag_link($flag, $action, $content_id) {
$token = flag_get_token($content_id);
return array(
'href' => "flag/" . ($flag->link_type == 'confirm' ? 'confirm/' : '') . "{$action}/{$flag->name}/{$content_id}",
'query' => drupal_get_destination() . ($flag->link_type == 'confirm' ? '' : '&token=' . $token),
);
}