function _subscriptions_mail_mail_edit_token_types in Subscriptions 7
Same name and namespace in other branches
- 2.0.x subscriptions_mail/subscriptions_mail.mail_edit.inc \_subscriptions_mail_mail_edit_token_types()
Implements hook_mail_edit_token_types().
Returns the available token types.
Parameters
$mailkey:
array $options:
Return value
array
1 call to _subscriptions_mail_mail_edit_token_types()
- subscriptions_mail_mail_edit_token_types in ./
subscriptions_mail.module - Implements hook_mail_edit_token_types().
File
- ./
subscriptions_mail.mail_edit.inc, line 57 - Subscriptions_mail module integration with Mail Editor module.
Code
function _subscriptions_mail_mail_edit_token_types($mailkey, $options = array()) {
global $language;
$massage_tokens =& drupal_static('subscriptions_mail_massage_tokens');
$massage_tokens = FALSE;
if (module_exists('token')) {
//dpm(token_get_info(), "TRIGGER HACK");
// Clear token.module's caches.
cache_clear_all('tree-rendered:', 'cache_token', TRUE);
cache_clear_all('tree:subs:', 'cache_token', TRUE);
cache_clear_all("info:{$language->language}", 'cache_token');
$token_get_info =& drupal_static('token_get_info');
$token_get_info = NULL;
$token_info =& drupal_static('token_info');
$token_info = NULL;
// We want to poison token.module's caches now!
$massage_tokens = TRUE;
// Trigger a refresh of token.module's caches.
token_get_info();
$massage_tokens = FALSE;
//dpm(token_get_info(), "HACK DONE");
// Clear the permanent cache, keeping token.module's static caches.
cache_clear_all("info:{$language->language}", 'cache_token');
}
$token_types = module_invoke_all('subscriptions', 'token_types', substr($mailkey, 19));
$token_types = array_merge($token_types, $mailkey == 'subscriptions_mail_digest' ? array(
'subs',
) : array(
'user',
'subs',
));
return $token_types;
}