? token-465434.patch Index: token.rules.inc =================================================================== RCS file: /cvs/drupal-contrib/contributions/modules/token/Attic/token.rules.inc,v retrieving revision 1.1.2.3 diff -u -p -r1.1.2.3 token.rules.inc --- token.rules.inc 31 May 2009 15:56:09 -0000 1.1.2.3 +++ token.rules.inc 5 Aug 2009 13:27:18 -0000 @@ -62,19 +62,20 @@ function token_rules_input_evaluator_app } foreach ($used_vars as $name) { - $type = $state['variables'][$name]->info['type']; + $type = _token_rules_map_type($state['variables'][$name]->info['type']); + if ($type) { + $token_id = _token_get_id($type, $vars[$name]); + if (isset($token_cache[$token_id]) && $token_cache[$token_id] != $name) { + // this is the same variable in another state + // so we need to flush the token cache to get the fresh values + token_get_values('global', NULL, TRUE); + } - $token_id = _token_get_id($type, $vars[$name]); - if (isset($token_cache[$token_id]) && $token_cache[$token_id] != $name) { - // this is the same variable in another state - // so we need to flush the token cache to get the fresh values - token_get_values('global', NULL, TRUE); - } - - $text = token_replace($text, $type, $vars[$name], '['. $name .':', ']'); + $text = token_replace($text, $type, $vars[$name], '['. $name .':', ']'); - // remember that this variable has been used and got cached - $token_cache[$token_id] = $name; + // remember that this variable has been used and got cached + $token_cache[$token_id] = $name; + } } } @@ -82,20 +83,33 @@ function token_rules_input_evaluator_app } /** + * Map rules types to corresponding token types + */ +function _token_rules_map_type($type) { + if (($data_type = rules_get_data_types($type)) && isset($data_type['token type'])) { + return $data_type['token type']; + } + return $type; +} + +/** * Some token replacement help for the condition/action edit form. */ function token_rules_input_evaluator_help($variables) { foreach ($variables as $name => $info) { - $form[$name] = array( - '#type' => 'fieldset', - '#title' => t('Replacement patterns for @name', array('@name' => $info['label'])), - '#collapsible' => TRUE, - '#collapsed' => TRUE, - ); - $form[$name]['content'] = array( - '#value' => theme('token_help', $info['type'], '['. $name .':', ']'), - ); + $type = _token_rules_map_type($info['type']); + if ($type) { + $form[$name] = array( + '#type' => 'fieldset', + '#title' => t('Replacement patterns for @name', array('@name' => $info['label'])), + '#collapsible' => TRUE, + '#collapsed' => TRUE, + ); + $form[$name]['content'] = array( + '#value' => theme('token_help', $type, '['. $name . ':', ']'), + ); + } } return $form; }