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.

CommentFileSizeAuthor
#2 ctools.582224.patch251 bytesgdud
#1 ctools.582224.patch421 bytesgdud

Comments

gdud’s picture

StatusFileSize
new421 bytes

A simple patch repair this:

gdud’s picture

StatusFileSize
new251 bytes

sorry, previous patch was not correct, this is good:

merlinofchaos’s picture

Status: Active » Fixed

There'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.

Status: Fixed » Closed (fixed)

Automatically closed -- issue fixed for 2 weeks with no activity.