You are here

function habitat_tokens in Habitat 7

Implements hook_tokens().

File

./habitat.tokens.inc, line 23
Provide a Habitat token "[site:habitat]".

Code

function habitat_tokens($type, $tokens, array $data = array(), array $options = array()) {
  $replacements = array();
  if ($type == 'site') {
    foreach ($tokens as $name => $original) {
      switch ($name) {
        case 'habitat':
          $variable = variable_get('habitat_variable', 'fetcher_environment');
          $replacements[$original] = variable_get($variable, '');
          break;
      }
    }
  }
  return $replacements;
}