You are here

function nodewords_tokens_token_values in Nodewords: D6 Meta Tags 6.2

Implements hook_token_values().

Parameters

$object: The module name of the search routine.

File

nodewords_tokens/nodewords_tokens.module, line 183
Implement tokens that can be used to set the content of meta tags.

Code

function nodewords_tokens_token_values($type, $object = NULL, $options = array()) {
  $values = array();
  if ($type == 'global') {
    $value = nodewords_unique_values(variable_get('nodewords_global_keywords_1', ''));
    $values['metatags-global-keywords-1-raw'] = $value;
    $values['metatags-global-keywords-1'] = check_plain($value);
    $value = nodewords_unique_values(variable_get('nodewords_global_keywords_2', ''));
    $values['metatags-global-keywords-2-raw'] = $value;
    $values['metatags-global-keywords-2'] = check_plain($value);
  }
  if ($type == 'node' && !empty($object)) {
    $values['metatags-description-raw'] = _nodewords_tokens_metatag_from_node_content($object);
    $values['metatags-description'] = check_plain($values['metatags-description-raw']);
    $value = '';
    if (module_exists('taxonomy')) {
      foreach (taxonomy_node_get_terms($object) as $term) {
        if (in_array($term->vid, variable_get('nodewords_keyword_vids', array()))) {
          $value .= ',' . $term->name;
        }
      }
    }
    $value = nodewords_unique_values($value);
    $values['metatags-taxonomy-keywords-raw'] = $value;
    $values['metatags-taxonomy-keywords'] = check_plain($value);
  }
  return $values;
}