function flag_get_link_types in Flag 7.3
Same name and namespace in other branches
- 5 flag.module \flag_get_link_types()
- 6.2 flag.module \flag_get_link_types()
- 6 flag.module \flag_get_link_types()
- 7.2 flag.module \flag_get_link_types()
Return an array of link types provided by modules.
Return value
An array of link types as defined by hook_flag_link_type_info(). These are keyed by the type name, and each value is an array of properties. In addition to those defined in hook_flag_link_type_info(), the following properties are set:
- 'module': The providing module.
- 'name': The machine name of the type.
See also
hook_flag_link_type_info_alter()
5 calls to flag_get_link_types()
- flag_check_link_types in includes/
flag.admin.inc - FormAPI after_build function to check that the link type exists.
- flag_flag::get_link_type in includes/
flag/ flag_flag.inc - Get the link type for this flag.
- flag_help in ./
flag.module - Implements hook_help().
- _flag_link_type_descriptions in ./
flag.module - Return an array of flag link type descriptions.
- _flag_link_type_options in ./
flag.module - Return an array of flag link types suitable for a select list or radios.
File
- ./
flag.module, line 2374 - The Flag module.
Code
function flag_get_link_types() {
$link_types =& drupal_static(__FUNCTION__);
if (!isset($link_types)) {
if ($cache = cache_get('flag_link_type_info')) {
$link_types = $cache->data;
}
// In some rare edge cases cache_get() can return an empty result. If it
// does, we make sure to fetch the link types again.
if (empty($link_types)) {
$link_types = array();
foreach (module_implements('flag_link_type_info') as $module) {
$module_types = module_invoke($module, 'flag_link_type_info');
foreach ($module_types as $type_name => $info) {
$link_types[$type_name] = $info + array(
'module' => $module,
'name' => $type_name,
'title' => '',
'description' => '',
'options' => array(),
'uses standard js' => TRUE,
'uses standard css' => TRUE,
'provides form' => FALSE,
);
}
}
drupal_alter('flag_link_type_info', $link_types);
cache_set('flag_link_type_info', $link_types);
}
}
return $link_types;
}