When creating the term links the uri callback key of the entity info is used. However, the Drupal API allows to override this per bundle which entity_uri checks. So instead of calling the callback directly entity_uri should be used to retrieve the callback. Then if I've overridden a specific bundle the correct links will be output.

CommentFileSizeAuthor
#5 tagcoulds.patch1.32 KBjax
tagclouds-entity-uri.patch676 bytesjax

Comments

jax’s picture

Status: Active » Needs review
jax’s picture

Status: Needs review » Needs work

This should be fixed in the other functions as well:
tagclouds_display_node_link_count()
tagclouds_display_term_link_count()

MGParisi’s picture

Please send another patch...

MGParisi’s picture

Also What exactly are you attempting to accomplish?

jax’s picture

StatusFileSize
new1.32 KB

In Drupal 6 you could override the default url taxonomy/term/% for a specific vocabulary by setting your module's name in the vocabularies table. In Drupal 7 this no longer works that way. With the entities sytem you can override URL creation by setting the uri callback on bundle level:

/**
 * Implements hook_entity_info_alter().
 */
function mymodule_entity_info_alter(&$info) {
  $info['taxonomy_term']['bundles']['tags']['uri callback'] = 'mymodule_tags_vocabulary_uri';
}

Then, if you use entity_uri(); you get the correct callback since that first checks if a callback on bundle level exists.

I've added a patch that also uses the taxonomy API function taxonomy_term_load instead of using the callback.

The function tagclouds_display_node_link_count() should also be fixed since the signature says $nid and then $node_info is initialised with the info from taxonomy_term. So either the variables should be renamed for clarity or the wrong info is loaded.

MGParisi’s picture

Status: Needs work » Needs review

Check out the dev release, I believe it should be working. However I am still concerned about

  $node_info = entity_get_info('taxonomy_term');
  if ($node = $node_info['load hook']($nid)) {
    $uri = $node_info['uri callback']($node);
MGParisi’s picture

FYI Dev release should have todays date, it has not updated yet. It will be in the repository until it does.

MGParisi’s picture

Jax (or anyone else) test out the Dev version?

MGParisi’s picture

Status: Needs review » Fixed

Should be in latest dev release when it is published.

Status: Fixed » Closed (fixed)

Automatically closed -- issue fixed for 2 weeks with no activity.

  • Commit d0333aa on 7.x-1.x, 8.x-1.x by MGParisi:
    Issue #1596516 by Jax: Switching to Entities