You are here

function messaging_template_text_replace in Messaging 6.3

Same name and namespace in other branches
  1. 6.4 messaging_template/messaging_template.module \messaging_template_text_replace()

Do token replacement. Was messaging_text_replace()

Uses token_logic if enabled, standard token replacement otherwise

1 call to messaging_template_text_replace()
Messaging_Template_Engine::text_replace in messaging_template/messaging_template.inc
Replace text with object tokens

File

messaging_template/messaging_template.module, line 170
Template system for Messaging Framework

Code

function messaging_template_text_replace($text, $objects, $language = NULL) {

  // If empty text, nothing to replace
  if (is_string($text) && !trim($text)) {
    return '';
  }

  // Add some token types
  $objects['global'] = NULL;

  // Use token_logic if available, ttp://code.developmentseed.org/token_logic
  // Otherwise use standard contrib token module, http://drupal.org/project/token
  if (module_exists('token_logic')) {
    return token_logic_replace_multiple($text, $objects);
  }
  else {
    return token_replace_multiple($text, $objects);
  }
}