You are here

function ctools_context_node_convert in Chaos Tool Suite (ctools) 7

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

Convert a context into a string.

1 call to ctools_context_node_convert()
ctools_context_node_edit_convert in plugins/contexts/node_edit_form.inc
Convert a context into a string.
1 string reference to 'ctools_context_node_convert'
node.inc in plugins/contexts/node.inc
Plugin to provide a node context. A node context is a node wrapped in a context object that can be utilized by anything that accepts contexts.

File

plugins/contexts/node.inc, line 172
Plugin to provide a node context. A node context is a node wrapped in a context object that can be utilized by anything that accepts contexts.

Code

function ctools_context_node_convert($context, $type) {
  $tokens = token_info();
  if (isset($tokens['tokens']['node'][$type])) {
    $values = token_generate('node', array(
      $type => $type,
    ), array(
      'node' => $context->data,
    ));
    if (isset($values[$type])) {
      return $values[$type];
    }
  }
}