function nat_nat_node_from_term_ctools_context in Node Auto Term [NAT] 7.2
Return a new context based on an existing context.
1 string reference to 'nat_nat_node_from_term_ctools_context'
- nat_nat_node_from_term_ctools_relationships in includes/
ctools/ relationships/ nat_node_from_term.inc - Implementation of specially named hook_ctools_relationships().
File
- includes/
ctools/ relationships/ nat_node_from_term.inc, line 27 - Provides a CTools (Panels) relationship that gets a node context from a term created by NAT.
Code
function nat_nat_node_from_term_ctools_context($context, $conf) {
// If unset it wants a generic, unfilled context, which is just NULL.
if (empty($context->data)) {
return ctools_context_create_empty('node', NULL);
}
if (isset($context->data->tid)) {
// Get the nid related to the term.
$nid = key(nat_get_nids(array(
$context->data->tid,
)));
if (!empty($nid)) {
// Load the node.
$node = node_load($nid);
// Generate the context.
return ctools_context_create('node', $node);
}
}
}