Will there be any work to port this module to D7, or is there more general approach to alter path (entity_uri) of any entity type?

Comments

pfx’s picture

subscribe

mstrelan’s picture

subscribe

dokuf’s picture

subscribe

cseppa’s picture

subscribe me too!

mstrelan’s picture

I started work on this but haven't got very far so if anyone wants to jump in they can as I won't be back for a while.

The key is to return the uri in hook_entity_info() as hook_term_path() no longer exists. Apart from this we just need to upgrade to use the new database layer and any other D7 conventions.

mstrelan’s picture

Further info. Not sure if I'm going down the right path but it seems good to me

<?php
/**
 * Implements hook_entity_info_alter().
 */
function taxonomy_redirect_entity_info_alter(&$entity_info) {
  $entity_info['taxonomy_term']['uri callback'] = 'taxonomy_redirect_term_uri_alter';
}

/**
 * Callback function for altering taxonomy term URIs.
 */
function taxonomy_redirect_term_uri_alter($term) {
  // TODO: Call another function or do some DB lookups etc
  return array('path' => 'helloworld/'. $term->tid);
}
?>

Anyone want to jump in?

bryancasler’s picture

subscribe

andypost’s picture

Title: D7 Port » D7 Port of Taxonomy Redirect
Status: Active » Needs work

More descriptive title to follow the issue.

Approach from #6 is right!

pauleb’s picture

subscribe

bryancasler’s picture

bump

Shadlington’s picture

Sub

Iztok’s picture

I am not the right person for this task but it looks like $entity_info['taxonomy_term']['uri callback'] only works for links other than:
- tabs
- terms listing in administration
- etc

All of this links are hardcoded like the one bellow:

taxonomy.admin.inc, line 343:
$form[$key]['view'] = array('#type' => 'link', '#title' => $term->name, '#href' => "taxonomy/term/$term->tid");

Problem is of course when you are editing a term, because you cant reach the url you would want (usually a view right...).

I guess the solution would be to redirect from taxonomy/term/*tid* to whatever.

Well anyway, code from #6 will work in links in menus, content fields etc but not in the administration.

mstrelan’s picture

I don't think you want to override the links in administration pages because they are required for editing / adding terms etc.

bryancasler’s picture

I'd be happy to test any suggestions.

Shadlington’s picture

Is it worth look at the Redirect module for possible integration?
I'm really not sure about whether its appropriate or not. Just thought I'd draw attention to it in case its useful.

pbfleetwood’s picture

subscribe

basicmagic.net’s picture

subscribe

laura s’s picture

subscribe

simon_s’s picture

subscribe

spencer.nowak’s picture

subscribe

WilliamV’s picture

Any updates on the status of porting? Thank you! Grtz.

mstrelan’s picture

@WilliamV - the status is that I started looking at this a while back but have not had any time to look at this further. Neither of the maintainers of this module have indicated that they are working on this and approximately 15 people have "subscribed" yet no one has provided anything particularly useful. If I should happen to get some free time and I feel compelled to work on this then perhaps I will continue, or if I get a project that requires this. So if anyone out there wants to pick up where I left off at #6 I'm sure everyone in this thread will be appreciative.

WilliamV’s picture

@mstrelan - I appreciate your efforts. I would be glad to help testing, but i don't really have the needed 'developer' experience to port this module. Hope you find some time soon for porting. Starting of at #6.

Tesmon’s picture

subscribe

andypost’s picture

I think the module should have different UI

- redirects should be added/changed at vocabulary|term edit form with form_FORMID_alter()
- list of redirects probably better to maintain as tab for admin/structure/taxonomy/redirects or
- settings for module could go into admin/config/content/taxonomy_redirect/settings
- needs hook_update_N() to use vocabulary_machine_name, maybe schema change
- implement hooks to reflect vocabulary update|delete and the same for terms
- php_filter staff should use new text formats API
- take into account token integration and upgrade path for old internal tokens

Also needs review #1120176: Remove t() from hook_schema()

mstrelan’s picture

@andypost - sounds like we should get 7.x-1.x out the door as a direct port and open up 7.x-2.x to accommodate any redesign

andypost’s picture

@mstrelan not sure, because D7 menu system is different from D6 also it's all about moving parts of code
By the same time core's APIs are changed so direct port is hard,
anyway we should decide on menu first, write some code and then provide upgrade path

yugongtian’s picture

+1

bryancasler’s picture

How will the Taxonomy Redirect module differ from the Redirect module?

http://drupal.org/project/redirect

vito_swat’s picture

@andypost
I don't really like the way you propose to do this. What me and probably most of users need is just possibility to redirect some vocabularies to other paths (most probably views paths). Any per path redirection, redirection based on term name etc can be handled by redirection and/or pathauto module.

Unless there will be any solution I suggest Taxonomy display to everyone who need just to override term listing with views.

xandeadx’s picture

subscribe

derhasi’s picture

Status: Needs work » Needs review

I just opened a sandbox as proof of concept of mstrelan's suggestion in #6.
You can find the project here: http://drupal.org/sandbox/derhasi/1177152, a fully functional module is available in the repository there.

I hope this work can go back here. Feel free to comment ;)

geek-merlin’s picture

sub

mstrelan’s picture

Thanks derhasi, this is a good start but it really needs some of the options like Path case and Separator. I will submit some issues and maybe some patches to your sandbox.

mstrelan’s picture

I just had a thought that you probably don't need this module if you already have Pathauto and CTools Page Manager enabled.

1. Pathauto
Setup URL aliases for terms to point to the path you want to redirect to.

2. Page manager
Override taxonomy/term/% and create a Variant with a selection rule to target the vocabulary holding the terms you want to redirect. Make the variant a HTTP_RESPONSE_CODE variant and 301 redirect it to the alias you set up in Pathauto.

Anyone know of any issues with this? One issue I am having is that page manager doesn't seem to want to sanitise my taxonomy term, which I want to send as an argument to a view.

geek-merlin’s picture

i'm using and loving derhasi's module from #32!

danharper’s picture

Hi,

Tried using module from #32 but I received this error message when I saved my path options in taxonomy vocab settings. (although the module does work)

Notice: Undefined index: mlid in _taxonomy_menu_create_item() (line 791 of var/www3/sites/all/modules/taxonomy_menu/taxonomy_menu.module)

Thanks Dan

reported http://drupal.org/node/1212770

geek-merlin’s picture

@dan: you might report this to the issue queue of the sandbox module.

derhasi’s picture

@Agileware, should i promote the sandbox to a full project, or do you want to provide a D7 branch?

goofrider’s picture

sub

mojzis’s picture

@vito_swat thanks for the tip, http://drupal.org/project/taxonomy_display did exactly what i needed :)

skizzo’s picture

subscribing

jvinci’s picture

subscribe

Danny Englander’s picture

Subscribing

mrryanjohnston’s picture

subscribe

Any updates on this? The sandbox module appears to be gone.

skizzo’s picture

1800collect’s picture

@skizzo (not sure why my reply isn't under yours.)

http://drupal.org/project/entity_path

This works and is the new "taxonomy redirect"! Thanks so much.

The module originally was a proof of concept for Taxonomy Redirect and named "Taxonomy Path" in sandbox mode. The original idea was from the Taxonomy Redirect D7 Port Issue. As we now deal with Entities in Drupal 7 all over the place, the concept could get generalized and now should work for any entity properly implementing the API function entity_uri() for its path.

Directions:

  1. Enable the module then go to Configuration > Content Authoring > Entity Paths (admin/config/content/entity_path)
  2. Click Add
  3. Under Instance select your Taxonomy Vocab you want to redirect
  4. Under Path Pattern put the new path you would like new_path/[term:name]
  5. IMPORTANT: Under additional information select "pathauto cleanstring" so that it uses the same clean string as before. If not Kids & Things will turn into "Kids %26 Things" instead of the more machine readable "kids-things"

That's it just click save, or mess with other options.

DamienMcKenna’s picture

Another alternative for this on D7 is http://drupal.org/project/taxonomy_display

fehin’s picture

@1800collect, how do you set the pattern for subdomains in Entity_path?

1800collect’s picture

@fehin

I am not sure what you mean regarding subdomains. Right now I can't even get my directions to work. Frustrated.

fehin’s picture

I used a different solution. I used views rewrite output on the taxonomy Term:name field and linked it to my views terms page. The views page I linked it to uses term id as an argument and in the url, so whenever someone clicks on a term it takes them to that page and that displays all contents with that term.

Frank Ralf’s picture

http://drupal.org/project/synonyms might be another alternative.

blogers’s picture

Issue summary: View changes

#47
1800collect commented 3 years ago

Dont work the module i install it y don hapend nothing

PalvinKang’s picture

#47 1800collect
I installed the entity_path module today and I got it to work (on a test site)

#53 blogers
may of had other issues

kamirura’s picture

This module solved it for me. Adds a redirect field to the term that takes the node adress.

kamirura’s picture

This module solved it for me. Adds a redirect field to the term that takes the node adress. https://www.drupal.org/project/taxonomy_tools
sorry for double post...