book['plid']) && $parent = book_link_load($object->book['plid'])) { $values['bookpathalias-raw'] = drupal_get_path_alias($parent['href']); $values['bookpathalias'] = check_plain($values['bookpathalias-raw']); } } // Tokens [termpath], [termpath-raw], and [termalias]. if (module_exists('taxonomy')) { // Get the lowest-weighted term from the lowest-weighted vocabulary. // This query is copied from @taxonomy_node_get_terms() $term = db_fetch_object(db_query_range('SELECT t.* FROM {term_node} r INNER JOIN {term_data} t ON r.tid = t.tid INNER JOIN {vocabulary} v ON t.vid = v.vid WHERE r.vid = %d ORDER BY v.weight, t.weight, t.name', $object->vid, 0, 1)); if ($term) { $values = array_merge($values, _pathauto_token_values('taxonomy', $term, $options, 'term')); } else { $values['termpath'] = ''; $values['termpath-raw'] = ''; $values['termalias'] = ''; } } break; case 'taxonomy': // In the realm of nodes these are 'terms', in the realm of taxonomy, 'cats'. if (!isset($label)) { $label = 'cat'; } $values[$label . 'path'] = ''; $values[$label . 'path-raw'] = ''; $values[$label . 'alias'] = ''; $values[$label . 'alias-raw'] = ''; // Tokens [catpath] and [catpath-raw]. if (isset($object->tid)) { module_load_include('inc', 'pathauto'); $parents = taxonomy_get_parents_all($object->tid); $catpath = $catpath_raw = array(); foreach ($parents as $parent) { $term_name_cleaned = pathauto_cleanstring($parent->name); array_unshift($catpath, check_plain($term_name_cleaned)); array_unshift($catpath_raw, $term_name_cleaned); } $values[$label . 'path'] = implode('/', $catpath); $values[$label . 'path-raw'] = implode('/', $catpath_raw); // Token [catalias-raw] and [catalias]. $values[$label . 'alias-raw'] = drupal_get_path_alias(taxonomy_term_path($object)); $values[$label . 'alias'] = check_plain($values[$label . 'alias-raw']); } break; } return $values; }