function flag_get_default_flags in Flag 6
Same name and namespace in other branches
- 5 flag.module \flag_get_default_flags()
- 6.2 flag.module \flag_get_default_flags()
- 7.3 flag.module \flag_get_default_flags()
- 7.2 flag.module \flag_get_default_flags()
Retrieve a list of flags defined by modules.
Parameters
$include_disabled: Unless specified, only enabled flags will be returned.
Return value
An array of flag prototypes, not usable for flagging. Use flag_get_flags() if needing to perform a flagging with any enabled flag.
3 calls to flag_get_default_flags()
- flag_admin_page in includes/
flag.admin.inc - Flag administration page. Display a list of existing flags.
- flag_form in includes/
flag.admin.inc - Add/Edit flag page.
- flag_get_flags in ./
flag.module - List all flags available.
File
- ./
flag.module, line 962
Code
function flag_get_default_flags($include_disabled = FALSE) {
$default_flags = array();
$flag_status = variable_get('flag_default_flag_status', array());
foreach (module_implements('flag_default_flags') as $module) {
$function = $module . '_flag_default_flags';
foreach ($function() as $config) {
$flag = flag_flag::factory_by_array($config);
$flag->module = $module;
// Add flags that have been enabled.
if (!isset($flag_status[$flag->name]) && (!isset($flag->status) || $flag->status) || !empty($flag_status[$flag->name])) {
$flag->status = TRUE;
$default_flags[$flag->name] = $flag;
}
elseif ($include_disabled) {
$flag->status = FALSE;
$default_flags[$flag->name] = $flag;
}
}
}
return $default_flags;
}