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'] = ''; } } } if ($type == 'taxonomy' && !empty($object)) { // 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)) { $parents = taxonomy_get_parents_all($object->tid); $catpath = $catpath_raw = array(); foreach ($parents as $parent) { array_unshift($catpath, check_plain($parent->name)); array_unshift($catpath_raw, $parent->name); } $values[$label . 'path'] = !empty($options['pathauto']) ? $catpath : implode('/', $catpath); $values[$label . 'path-raw'] = !empty($options['pathauto']) ? $catpath_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']); } } return $values; }