You are here

function ctools_context_create_term in Chaos Tool Suite (ctools) 7

Same name and namespace in other branches
  1. 6 plugins/contexts/term.inc \ctools_context_create_term()

It's important to remember that $conf is optional here, because contexts are not always created from the UI.

1 string reference to 'ctools_context_create_term'
term.inc in plugins/contexts/term.inc
Plugin to provide a term context.

File

plugins/contexts/term.inc, line 40
Plugin to provide a term context.

Code

function ctools_context_create_term($empty, $data = NULL, $conf = FALSE) {
  $context = new ctools_context('term');
  $context->plugin = 'term';
  if ($empty) {
    return $context;
  }
  if ($conf && isset($data['tid'])) {
    $data = taxonomy_term_load($data['tid']);
  }
  if (!empty($data)) {
    $context->data = $data;
    $context->title = $data->name;
    $context->argument = $data->tid;
    $context->description = $data->description;
    return $context;
  }
}