You are here

function flag_get_flag in Flag 6

Same name and namespace in other branches
  1. 5 flag.module \flag_get_flag()
  2. 6.2 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: (optional) The flag name.

$fid: (optional) The the flag id.

Return value

The flag object, or FALSE if no matching flag was found.

26 calls to flag_get_flag()
flag in ./flag.module
Flags or unflags an item.
FlagTestCase::testFlagAdmin in tests/flag.test
Create a flag through the UI and ensure that it is saved properly.
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.

... See full list

File

./flag.module, line 852

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;
      }
    }
  }
}