You are here

function flag_flag::factory_by_array in Flag 6

Same name and namespace in other branches
  1. 5 flag.inc \flag_flag::factory_by_array()
  2. 6.2 flag.inc \flag_flag::factory_by_array()
  3. 7.3 includes/flag/flag_flag.inc \flag_flag::factory_by_array()
  4. 7.2 flag.inc \flag_flag::factory_by_array()

Create a complete flag (except an FID) from an array definition.

1 call to flag_flag::factory_by_array()
flag_get_default_flags in ./flag.module
Retrieve a list of flags defined by modules.

File

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

Class

flag_flag
This abstract class represents a flag, or, in Views 2 terminology, "a handler".

Code

function factory_by_array($config) {
  $flag = flag_create_handler($config['content_type']);
  foreach ($config as $option => $value) {
    $flag->{$option} = $value;
  }
  if (is_array($config['locked'])) {
    $flag->locked = drupal_map_assoc($config['locked']);
  }
  return $flag;
}