You are here

function ctools_term_from_node_context in Chaos Tool Suite (ctools) 6

Same name and namespace in other branches
  1. 7 plugins/relationships/term_from_node.inc \ctools_term_from_node_context()

Return a new context based on an existing context.

1 string reference to 'ctools_term_from_node_context'
term_from_node.inc in plugins/relationships/term_from_node.inc
Plugin to provide an relationship handler for term from node.

File

plugins/relationships/term_from_node.inc, line 26
Plugin to provide an relationship handler for term from node.

Code

function ctools_term_from_node_context($context, $conf) {

  // If unset it wants a generic, unfilled context, which is just NULL.
  if (empty($context->data)) {
    return ctools_context_create_empty('term', NULL);
  }
  if (isset($context->data->taxonomy)) {
    foreach ($context->data->taxonomy as $term) {
      if ($term->vid == $conf['vid']) {
        return ctools_context_create('term', $term);
      }
    }
  }
}