You are here

function flag_get_flag in Flag 5

Same name and namespace in other branches
  1. 6.2 flag.module \flag_get_flag()
  2. 6 flag.module \flag_get_flag()
  3. 7.3 flag.module \flag_get_flag()
  4. 7.2 flag.module \flag_get_flag()

Load a single flag either by name or by flag ID.

Parameters

$name: The the flag name.

$fid: The the flag id.

19 calls to flag_get_flag()
flag in ./flag.module
Flags or unflags an item.
flag_actions_delete_form in ./flag_actions.module
flag_actions_form in ./flag_actions.module
Generic configuration form for configuration of flag actions.
flag_confirm in ./flag.module
Form for confirming the (un)flagging of a piece of content.
flag_confirm_submit in ./flag.module

... See full list

File

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

Code

function flag_get_flag($name = NULL, $fid = NULL) {
  $flags = flag_get_flags();
  if (isset($name)) {
    if (isset($flags[$name])) {
      return $flags[$name];
    }
  }
  elseif (isset($fid)) {
    foreach ($flags as $flag) {
      if ($flag->fid == $fid) {
        return $flag;
      }
    }
  }
}