function flag_load in Flag 6.2
Same name and namespace in other branches
- 7.3 flag.module \flag_load()
- 7.2 flag.module \flag_load()
Menu loader for '%flag' arguments.
Parameters
$include_disabled: Whether to return a disabled flag too. Normally only enabled flags are returned. Some menu items operate on disabled flags and in this case you need to turn on this switch by doing <code>'load arguments' => array(TRUE)</code> in your menu router.
Return value
Either the flag object, or FALSE if none was found.
3 calls to flag_load()
- flag_export_flags in includes/
flag.export.inc - Export a flag to code.
- flag_features_export in includes/
flag.features.inc - Implements hook_features_export().
- flag_features_revert in includes/
flag.features.inc - Implements hook_features_revert().
File
- ./
flag.module, line 139 - The Flag module.
Code
function flag_load($flag_name, $include_disabled = FALSE) {
if ($flag = flag_get_flag($flag_name)) {
return $flag;
}
else {
// No enabled flag was found. Search among the disabled ones.
if ($include_disabled) {
$default_flags = flag_get_default_flags(TRUE);
if (isset($default_flags[$flag_name])) {
return $default_flags[$flag_name];
}
}
}
// A menu loader has to return FALSE (not NULL) when no object is found.
return FALSE;
}