You are here

function hook_flag_access in Flag 7.3

Same name and namespace in other branches
  1. 6.2 flag.api.php \hook_flag_access()
  2. 7.2 flag.api.php \hook_flag_access()

Allow modules to allow or deny access to flagging for a single entity.

Called when displaying a single entity view or edit page. For flag access checks from within Views, implement hook_flag_access_multiple().

Parameters

flag_flag $flag: The flag object.

$entity_id: The id of the entity in question.

string $action: The action to test. Either 'flag' or 'unflag'.

$account: The user on whose behalf to test the flagging action.

Return value

One of the following values:

  • TRUE: User has access to the flag.
  • FALSE: User does not have access to the flag.
  • NULL: This module does not perform checks on this flag/action.

NOTE: Any module that returns FALSE will prevent the user from being able to use the flag.

See also

hook_flag_access_multiple()

flag_flag:access()

2 functions implement hook_flag_access()

Note: this list is generated by pattern matching, so it may include some functions that are not actually implementations of this hook.

flagaccesstest_flag_access in tests/flagaccesstest/flagaccesstest.module
Implements hook_flag_access.
flag_flag_access in ./flag.module
Implements hook_flag_access().
1 invocation of hook_flag_access()
flag_flag::access in includes/flag/flag_flag.inc
Determines whether the user may flag, or unflag, the given entity.

File

./flag.api.php, line 231
Hooks provided by the Flag module.

Code

function hook_flag_access($flag, $entity_id, $action, $account) {
}