You are here

function messaging_template_text_part in Messaging 6.4

Get text part with group and method fallback

Return value

string Or NULL if not found

1 call to messaging_template_text_part()
messaging_template_build in messaging_template/messaging_template.module
Build message from template with token replacement

File

messaging_template/messaging_template.module, line 205
Drupal Messaging Framework - Messaging template

Code

function messaging_template_text_part($group, $key, $method, $language) {
  $original_group = $group;
  while ($group) {
    if ($part = messaging_template_message_part($group, $key, $method, $language)) {

      // Found template text, check for empty marker and return
      return $part->message === MESSAGING_TEMPLATE_EMPTY ? '' : $part;
    }
    else {
      $group = messaging_template_group_fallback($group);
    }
  }

  // Try language fallback if language is not default
  if ($language_fallback = messaging_template_language_fallback($language)) {
    return messaging_template_text_part($original_group, $key, $method, $language_fallback);
  }
}