function flag_fetch_definition in Flag 5
Same name and namespace in other branches
- 6.2 flag.inc \flag_fetch_definition()
- 6 flag.inc \flag_fetch_definition()
- 7.3 flag.module \flag_fetch_definition()
- 7.2 flag.inc \flag_fetch_definition()
Returns a flag definition.
4 calls to flag_fetch_definition()
- flag_add_form in includes/
flag.admin.inc - Present a form for creating a new flag, setting the type of flag.
- flag_create_handler in ./
flag.inc - Instantiates a new flag handler. A flag handler is more commonly know as "a flag". A factory method usually populates this empty flag with settings loaded from the database.
- flag_get_types in ./
flag.inc - Returns all flag types defined on the system.
- flag_link in ./
flag.module - Implementation of hook_link().
File
- ./
flag.inc, line 41 - Implements various flags. Uses object oriented style inspired by that of Views 2.
Code
function flag_fetch_definition($content_type = NULL) {
static $cache;
if (!isset($cache)) {
$cache = module_invoke_all('flag_definitions');
if (!isset($cache['node'])) {
// We want our API to be available in hook_install, but our module is not
// enabled by then, so let's load our implementation directly:
$cache += flag_flag_definitions();
}
}
if (isset($content_type)) {
if (isset($cache[$content_type])) {
return $cache[$content_type];
}
}
else {
return $cache;
}
}