Instead of using /taxonomy/term/123 I wanted jump menu to use the defined url aliases. (Because I'm using some special views which don't work with the internal path.)
Since this might be useful for more users here is my simple change (in jump.module):
// altered function
function jump_menu_get_taxo_options(&$options, $vid) {
$tree = taxonomy_get_tree($vid);
global $language;
$lang = $language->language;
$options['#'] = t('Choose an issue...');
foreach ($tree as $term) {
if ( $term->language == $lang || $term->language == '' ) {
$options[jump_get_url_alias(taxonomy_term_path($term))] = $term->name;
}
}
}
// added function
function jump_get_url_alias( $src ){
if ( $query = db_query( "SELECT * FROM {url_alias}
WHERE src='%s'", $src ) ){
if ( $rs = db_fetch_object( $query ) ){
return $rs->dst;
}
else {
return $src;
}
}
else {
return $src;
}
}
Regards,
Paul
| Comment | File | Size | Author |
|---|---|---|---|
| #3 | jump_taxo-url-aliases_HEAD.patch | 1.27 KB | khalor |
| #2 | jump_taxonomy-url-aliases.patch | 1.26 KB | khalor |
Comments
Comment #1
marcp commentedPaul - if you are able to create a patch for this feature and submit it here it will help me test it out to see if it can get included.
Comment #2
khalor commentedI needed this functionality for a project, and sin.star's code seems to do the trick (mostly).
Here's a patch (only the 2nd time I've diff'd something, hopefully it works).
Things that need work:
Showing the active page in the Jump menu no longer works for Taxonomy
'Select an issue...' placeholder item should be configurable
Comment #3
khalor commentedRe-rolled patch against HEAD
Comment #4
nicholas.alipaz commentedKhalor, we won't likely be using that patch. A simple call to the database is not a way to go for this. We should utilize drupal_get_path_alias() for this.
I also suggest doing a quick read-through of the coding standards.
Comment #5
broonYes, Nicholas is right. Actually, I forgot about this "patch" while in the meantime already using the mentioned built-in function drupal_get_path_alias().
Regards,
Paul
Comment #6
nicholas.alipaz commentedNot sure why we're closing this, the feature should still be added even if you don't plan on writing the patch.
Comment #7
marcp commented@nicholas - I'm moving this to 6.x-2.x-dev. Move it back on in to 1.x if you think it belongs there.
Comment #8
nicholas.alipaz commentedgreat, thanks. It isn't a bug, but a feature request, so I agree it should be moved to 2.x
Comment #9
khalor commentedJust a note that this problem can also be solved in the mean time (together with correctly selecting the active item in the jump menu) by using Taxonomy Redirect
Comment #10
nicholas.alipaz commentedglobal redirect could likely help too. Especially since search engines aren't going to attempt following a jump menu anyhow.
Comment #11
wxman commentedJust adding my 2cents. This worked for me, and global redirect does not seem work on the jump menu addresses. I did remove the $options['#'] = t('Choose an issue...'); line because I wanted to control that from the module admin section. Thanks for the patch.
Comment #12
manoloka commentedsubscribe