function 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 25

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('entity:taxonomy_term', NULL);
    }
    if (isset($context->data->taxonomy)) {
        foreach ($context->data->taxonomy as $term) {
            if ($term->vid == $conf['vid']) {
                return ctools_context_create('entity:taxonomy_term', $term);
            }
        }
    }
}