function flag_fetch_definition in Flag 7.3
Same name and namespace in other branches
- 5 flag.inc \flag_fetch_definition()
- 6.2 flag.inc \flag_fetch_definition()
- 6 flag.inc \flag_fetch_definition()
- 7.2 flag.inc \flag_fetch_definition()
Get a flag type definition.
Parameters
string $entity_type: (optional) The entity type to get the definition for, or NULL to return all flag types.
Return value
The flag type definition array.
See also
5 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_add_page in includes/
flag.admin.inc - Menu callback for adding a new flag.
- flag_create_handler in ./
flag.module - Instantiates a new flag handler.
- flag_get_types in ./
flag.module - Returns all flag types defined on the system.
- flag_views_data_alter in includes/
views/ flag.views.inc - Implements hook_views_data_alter().
File
- ./
flag.module, line 527 - The Flag module.
Code
function flag_fetch_definition($entity_type = NULL) {
$definitions =& drupal_static(__FUNCTION__);
if (!isset($definitions)) {
if ($cache = cache_get('flag_type_info')) {
$definitions = $cache->data;
}
else {
$definitions = module_invoke_all('flag_type_info');
drupal_alter('flag_type_info', $definitions);
cache_set('flag_type_info', $definitions);
}
}
if (isset($entity_type)) {
if (isset($definitions[$entity_type])) {
return $definitions[$entity_type];
}
}
else {
return $definitions;
}
}