You are here

function ctools_set_variable_token in Chaos Tool Suite (ctools) 7

Same name and namespace in other branches
  1. 6 ctools.module \ctools_set_variable_token()

Set a replacement token from the containing element's children during #post_render.

This function can be used like this: $token = ctools_set_variable_token('tabs');

The token "<!-- ctools-page-tabs -->" would then be replaced by the value of this element's (sibling) render array key 'tabs' during post-render (or be deleted if there was no such key by that point).

Parameters

string $token: The token string for the page callback, e.g. 'title'.

Return value

string The constructed token.

See also

ctools_set_callback_token()

ctools_page_token_processing()

2 calls to ctools_set_variable_token()
CtoolsPageTokens::testReplaceVariableToken in tests/page_tokens.test
Test that we can set page tokens.
CtoolsPageTokens::testSetVariableToken in tests/page_tokens.test
Test that we can set page tokens.

File

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

Code

function ctools_set_variable_token($token) {
  $string = '<!-- ctools-page-' . $token . ' -->';
  ctools_set_page_token($string, 'variable', $token);
  return $string;
}