You are here

function ctools_set_page_token in Chaos Tool Suite (ctools) 6

Same name and namespace in other branches
  1. 7 ctools.module \ctools_set_page_token()

Set a token/value pair to be replaced later in the request, specifically in ctools_preprocess_page().

Parameters

$token: The token to be replaced later, during page rendering. This should ideally be a string inside of an HTML comment, so that if there is no replacement, the token will not render on the page.

$type: The type of the token. Can be either 'variable', which will pull data directly from the page variables

$argument: If $type == 'variable' then argument should be the key to fetch from the $variables. If $type == 'callback' then it should either be the callback, or an array that will be sent to call_user_func_array().

Return value

A array of token/variable names to be replaced.

3 calls to ctools_set_page_token()
ctools_preprocess_page in ./ctools.module
A theme preprocess function to allow content type plugins to use page template variables which are not yet available when the content type is rendered.
ctools_set_callback_token in ./ctools.module
Easily set a token from the page variables.
ctools_set_variable_token in ./ctools.module
Easily set a token from the page variables.

File

./ctools.module, line 300
CTools primary module file.

Code

function ctools_set_page_token($token = NULL, $type = NULL, $argument = NULL) {
  static $tokens = array();
  if (isset($token)) {
    $tokens[$token] = array(
      $type,
      $argument,
    );
  }
  return $tokens;
}