You are here

function flag_create_handler in Flag 6

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

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.

5 calls to flag_create_handler()
flag_flag::factory_by_array in ./flag.inc
Create a complete flag (except an FID) from an array definition.
flag_flag::factory_by_content_type in ./flag.inc
Another factory method. Returns a new, "empty" flag; e.g., one suitable for the "Add new flag" page.
flag_flag::factory_by_row in ./flag.inc
Creates a flag from a database row. Returns it.
flag_rules_action_info in includes/flag.rules.inc
Implementation of hook_rules_action_info().
flag_rules_condition_info in includes/flag.rules.inc
Implementation of hook_rules_condition_info().

File

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

Code

function flag_create_handler($content_type) {
  $definition = flag_fetch_definition($content_type);
  if (isset($definition) && class_exists($definition['handler'])) {
    $handler = new $definition['handler']();
  }
  else {
    $handler = new flag_broken();
  }
  $handler->content_type = $content_type;
  $handler
    ->construct();
  return $handler;
}