You are here

function favicon_tokens in Favicon 7.2

Implements hook_tokens().

File

./favicon.tokens.inc, line 23
Token integration for the Favicon module.

Code

function favicon_tokens($type, $tokens, array $data = array(), array $options = array()) {
  $sanitize = !empty($options['sanitize']);
  $replacements = array();
  if ($type == 'site') {
    foreach ($tokens as $name => $original) {
      switch ($name) {
        case 'favicon-url':
          if ($file = favicon_get_favicon_file()) {
            $url = file_create_url($file->uri);
            $replacements[$original] = $sanitize ? check_url($url) : $url;
          }
          break;
      }
    }
  }
  return $replacements;
}