| [ Index ] |
PHP Cross Reference of Drupal 6 (gatewave) |
[Summary view] [Print] [Text view]
1 <?php 2 // $Id: token_taxonomy.inc,v 1.3.4.5 2010/06/05 16:45:58 davereid Exp $ 3 4 /** 5 * @file 6 * Implementations of token module hooks for the core taxonomy module. 7 * 8 * The token module requires specific hooks to be added to modules 9 * so that those modules can return data about their objects to the 10 * token API. Until and unless token becomes a part of core, the 11 * implementations of the token hooks for core modules are provided 12 * in the token module itself. 13 * 14 * @ingroup token 15 */ 16 17 /** 18 * Implementation of hook_token_values(). 19 */ 20 function taxonomy_token_values($type, $object = NULL, $options = array()) { 21 $values = array(); 22 switch ($type) { 23 case 'taxonomy': 24 $category = $object; 25 $vid = $category->vid; 26 $vocabulary = taxonomy_vocabulary_load($vid); 27 28 $values['tid'] = $category->tid; 29 $values['cat'] = check_plain($category->name); 30 $values['cat-raw'] = $category->name; 31 $values['cat-description'] = filter_xss($category->description); 32 $values['vid'] = $vid; 33 $values['vocab'] = check_plain($vocabulary->name); 34 $values['vocab-raw'] = $vocabulary->name; 35 $values['vocab-description'] = filter_xss($vocabulary->description); 36 37 break; 38 } 39 return $values; 40 } 41 42 /** 43 * Implementation of hook_token_list(). 44 */ 45 function taxonomy_token_list($type = 'all') { 46 if ($type == 'taxonomy' || $type == 'all') { 47 $tokens['taxonomy']['tid'] = t('The id number of the category.'); 48 $tokens['taxonomy']['cat'] = t('The name of the category.'); 49 $tokens['taxonomy']['cat-raw'] = t('The unfiltered name of the category.'); 50 $tokens['taxonomy']['cat-description'] = t('The optional description of the taxonomy term.'); 51 $tokens['taxonomy']['vid'] = t("The id number of the category's parent vocabulary."); 52 $tokens['taxonomy']['vocab'] = t("The vocabulary that the page's first category belongs to."); 53 $tokens['taxonomy']['vocab-raw'] = t("The unfiltered vocabulary that the page's first category belongs to."); 54 $tokens['taxonomy']['vocab-description'] = t('The optional description of the taxonomy vocabulary.'); 55 56 return $tokens; 57 } 58 }
title
Description
Body
title
Description
Body
title
Description
Body
title
Body
| Generated: Thu Mar 24 11:18:33 2011 | Cross-referenced by PHPXref 0.7 |