You are here

function textimage_tokens in Textimage 7.3

Same name and namespace in other branches
  1. 8.4 textimage.module \textimage_tokens()
  2. 8.3 textimage.module \textimage_tokens()

Implements hook_tokens().

File

./textimage.module, line 291
Textimage - Provides text to image manipulations.

Code

function textimage_tokens($type, $tokens, array $data = array(), array $options = array()) {

  // Jumps out if not processing textimage tokens.
  if ($type != 'textimage') {
    return array();
  }

  // Jumps out with a warning if node is not available.
  if (!isset($data['node'])) {
    _textimage_diag(t('Textimage token(s) @tokens_list could not be resolved as no information about the context was available.', array(
      '@tokens_list' => implode(', ', $tokens),
    )), WATCHDOG_WARNING);
    return array();
  }

  // Process tokens.
  $replacements = TextimageImager::processTokens('url', $tokens, $data['node']);
  $replacements += TextimageImager::processTokens('uri', $tokens, $data['node']);
  return $replacements;
}