You are here

function context_field_clone_default in Context Field 7

Clones a context in order to make a new one.

1 call to context_field_clone_default()
context_field_field_insert in ./context_field.module
Implements hook_field_insert().

File

./context_field.module, line 115
Context Field

Code

function context_field_clone_default($default_name, $custom_name, $description = 'custom', $category = FALSE) {
  $context = context_load($default_name);
  $context->name = $custom_name;
  $context->description = $description;
  $context->tag = 'Context Field Custom';
  if ($category) {
    $context->conditions['context_field']['options']['context_field_category'] = $category;
  }
  unset($context->conditions['context_field']['values'][2]);
  context_save($context);
}