function taxonomy_menu_path_custom in Taxonomy menu 7.2
Same name and namespace in other branches
- 8 taxonomy_menu_custom_paths/taxonomy_menu_custom_paths.module \taxonomy_menu_path_custom()
Callback for hook_taxonomy_menu_path.
5 string references to 'taxonomy_menu_path_custom'
- TaxonomyMenuCustomPathConfigurationTest::testTaxonomyMenuCustomPathBasePathOption in taxonomy_menu_custom_paths/
tests/ taxonomy_menu_custom_paths.test - Tests if the path is correct without the depth option.
- TaxonomyMenuCustomPathConfigurationTest::testTaxonomyMenuCustomPathDepthOption in taxonomy_menu_custom_paths/
tests/ taxonomy_menu_custom_paths.test - Tests if the path is correct with both the base path and the depth option.
- TaxonomyMenuCustomPathFunctionalTest::testTaxonomyMenuCustomPathVocabularyInterface in taxonomy_menu_custom_paths/
tests/ taxonomy_menu_custom_paths.test - Saves, edits and deletes a taxonomy vocabulary using the user interface.
- taxonomy_menu_custom_paths_form_taxonomy_form_vocabulary_alter in taxonomy_menu_custom_paths/
taxonomy_menu_custom_paths.module - Implements hook_form_FORM_ID_alter().
- taxonomy_menu_custom_paths_vocabulary_validate in taxonomy_menu_custom_paths/
taxonomy_menu_custom_paths.module - Validation handler for settings of custom path in the taxonomy vocabulary.
File
- taxonomy_menu_custom_paths/
taxonomy_menu_custom_paths.module, line 106 - taxonomy_menu_custom_paths module
Code
function taxonomy_menu_path_custom($term) {
$path = '';
$tids = array();
$base_path = taxonomy_menu_variable_get('custom_path_base', $term->vid, '');
$depth = taxonomy_menu_variable_get('custom_path_depth', $term->vid, '');
// When tid equals 0, we are dealing with a vocabulary item. We want the path
// to be a mulitple term path.
if ($term->tid == 0) {
$tids = _taxonomy_menu_get_tids($term->vid);
}
else {
$tids[] = $term->tid;
$terms = taxonomy_get_tree($term->vid, $term->tid);
foreach ($terms as $term) {
$tids[] = $term->tid;
}
}
// Build the path.
if ($tids) {
$path = $base_path . '/' . implode('+', $tids);
}
else {
$path = $base_path . '/' . $term->tid;
}
if ($depth != '') {
$path .= '/' . $depth;
}
return $path;
}