When we use more than 1 token in page content, only 1 of them (first) will be replaced with the correct value. Other tokens replaced by "Array" value in html output. In fact, this "array" is, for example:
array(
0 => 'variable',
1 => 'title'
)
Look at the bold peace of code in ctools.modue:
function ctools_preprocess_page(&$variables) {
$tokens = ctools_set_page_token();
if (!empty($tokens)) {
foreach ($tokens as $token => $key) {
list($type, $argument) = $key;
switch ($type) {
case 'variable':
$tokens[$token] = isset($variables[$argument]) ? $variables[$argument] : '';
break;
case 'callback':
if (is_string($argument) && function_exists($argument)) {
$tokens[$token] = $argument();
}
if (is_array($argument) && function_exists($argument[0])) {
$tokens[$token] = call_user_func_array($argument);
}
break;
}
<strong>$variables['content'] = strtr($variables['content'], $tokens);</strong>
}
}
}
In page content, tokens were replaced already after getting value for first token. But this action should take place after the getting all of tokens values. So, line of code:
$variables['content'] = strtr($variables['content'], $tokens);
should be for the next closing brace, after the end of the foreach.
Comments
Comment #1
gdud commentedA simple patch repair this:
Comment #2
gdud commentedsorry, previous patch was not correct, this is good:
Comment #3
merlinofchaos commentedThere's a really good reason that patches should be applied against the latest -dev version: Because then you don't duplicate work that's already been done.