You are here

function ctools_context_node_convert_list in Chaos Tool Suite (ctools) 6

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

Provide a list of ways that this context can be converted to a string.

1 call to ctools_context_node_convert_list()
ctools_context_node_edit_convert_list in plugins/contexts/node_edit_form.inc
Provide a list of ways that this context can be converted to a string.
1 string reference to 'ctools_context_node_convert_list'
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 164
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_list() {
  $list = array(
    'nid' => t('Node ID'),
    'vid' => t('Node revision ID'),
    'title' => t('Node title'),
    'uid' => t('Author UID'),
    'type' => t('Node type'),
  );

  // Include tokens provided by token.module.
  if (module_exists('token')) {
    foreach (token_get_list(array(
      'node',
    )) as $tokens) {
      $readabletokens = array();
      foreach ($tokens as $fieldname => $desc) {
        $readabletokens[$fieldname] = $fieldname . ': ' . $desc;
      }
      $list += $readabletokens;
    }
  }
  return $list;
}