You are here

function sms_tokens in SMS Framework 7

Same name and namespace in other branches
  1. 8 sms.tokens.inc \sms_tokens()
  2. 2.x sms.tokens.inc \sms_tokens()
  3. 2.1.x sms.tokens.inc \sms_tokens()

Implements hook_tokens().

File

./sms.tokens.inc, line 31
Token callbacks for the sms module.

Code

function sms_tokens($type, $tokens, array $data = array(), array $options = array()) {
  $replacements = array();
  $sanitize = !empty($options['sanitize']);

  // Text format tokens.
  if ($type == 'sms' && !empty($data['sms'])) {
    $sms = $data['sms'];
    foreach ($tokens as $name => $original) {
      switch ($name) {
        case 'number':
          $replacements[$original] = check_plain($sms['number']);
          break;
        case 'message':
          $replacements[$original] = check_plain($sms['message']);
          break;
      }
    }
  }
  return $replacements;
}