You are here

function token_rules_input_evaluator_prepare in Token 6

Prepares the evalution.

Parameters

$string: The string to evaluate later.

$variables: An array of available variables.

Return value

Arbitrary data, which is passed to the evaluator on evaluation. If NULL is returned the input evaluator will be skipped later.

File

./token.rules.inc, line 33
Rules integration for the token module.

Code

function token_rules_input_evaluator_prepare($string, $variables) {
  $used_vars = array();
  foreach ($variables as $name => $info) {
    if (strpos($string, TOKEN_PREFIX . $name . ':') !== FALSE) {
      $used_vars[] = $name;
    }
  }

  // Using ':global' instead of 'global' to avoid potential namespace conflicts
  // See http://drupal.org/node/932460#comment-3884866
  $used_vars[] = ':global';
  return $used_vars ? $used_vars : NULL;
}