You are here

function flag_fetch_definition in Flag 7.2

Same name and namespace in other branches
  1. 5 flag.inc \flag_fetch_definition()
  2. 6.2 flag.inc \flag_fetch_definition()
  3. 6 flag.inc \flag_fetch_definition()
  4. 7.3 flag.module \flag_fetch_definition()

Returns a flag definition.

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_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
Implements hook_link().
flag_views_data_alter in includes/flag.views.inc
Implements hook_views_data_alter().

File

./flag.inc, line 65
Implements various flags. Uses object oriented style inspired by that of Views 2.

Code

function flag_fetch_definition($content_type = NULL) {
  $defintions =& drupal_static(__FUNCTION__);
  if (!isset($defintions)) {
    $defintions = module_invoke_all('flag_definitions');
    drupal_alter('flag_definitions', $defintions);
    if (!isset($defintions['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:
      $defintions += flag_flag_definitions();
    }
  }
  if (isset($content_type)) {
    if (isset($defintions[$content_type])) {
      return $defintions[$content_type];
    }
  }
  else {
    return $defintions;
  }
}