function flag in Flag 7.3
Same name and namespace in other branches
- 5 flag.module \flag()
- 6.2 flag.module \flag()
- 6 flag.module \flag()
- 7.2 flag.module \flag()
Flags or unflags an item.
Parameters
$action: Either 'flag' or 'unflag'.
$flag_name: The name of the flag to use.
$entity_id: The ID of the item to flag or unflag.
$account: (optional) The user on whose behalf to flag. Omit for the current user.
permissions_check: (optional) A boolean indicating whether to skip permissions.
Return value
FALSE if some error occured (e.g., user has no permission, flag isn't applicable to the item, etc.), TRUE otherwise.
5 calls to flag()
- FlagEntityFieldQueryTestCase::testEntityFieldQuery in tests/
flag.test - Test use of EntityFieldQuery with flagging entities.
- flag_field_attach_save in ./
flag.module - Shared saving routine between flag_field_attach_insert/update().
- flag_nodes in ./
flag.module - Callback function for hook_node_operations().
- flag_trim_flag in ./
flag.module - Trim a flag to a certain size.
- flag_users in ./
flag.module - Callback function for hook_user_operations().
85 string references to 'flag'
- FlagAccessFormTestCase::setUp in tests/
flag.test - Implements setUp().
- FlagAccessLinkTestCase::setUp in tests/
flag.test - Implements setUp().
- FlagAdminTestCase::setUp in tests/
flag.test - Implements setUp().
- FlagCommentOptimizationTestCase::setUp in tests/
flag.test - Implements setUp().
- FlagEntityFieldQueryTestCase::setUp in tests/
flag.test - Implements setUp().
File
- ./
flag.module, line 1319 - The Flag module.
Code
function flag($action, $flag_name, $entity_id, $account = NULL, $permissions_check = FALSE) {
if (!($flag = flag_get_flag($flag_name))) {
// Flag does not exist.
return FALSE;
}
return $flag
->flag($action, $entity_id, $account, $permissions_check);
}