There currently is *no* way to theme a term link. Thats not good [tm].

Because I think this is not just a simple featurem, but required for good themeing (note that even "silly-er" functions have extremely complex theme functions) I categorise it as a Bug and not a task or a feature!

This patch allows themes to override the term-links by themeing a very simple function.

CommentFileSizeAuthor
drupal_841.28 KBBèr Kessels
Support from Acquia helps fund testing for Drupal Acquia logo

Comments

moshe weitzman’s picture

Category: bug » feature

why would someone want to theme a term link? how is this different from links to users or links to nodes.

Bèr Kessels’s picture

I want it for one:

function remixreading_term_link($term) {
  return taxonomy_image_display($term->tid)." ".l($term->name, 'taxonomy/term/'. $term->tid);
}

and other might want fancy opportunities here:

function mytheme_term_link($term) {
  if(in_array($term->vid, $array_of_fancy_vocs)) {
    return '<div id=voc-'.$term->vid.'">'.l($term->name, 'taxonomy/term/'. $term->tid).'</div>;
  }
  else {
     return l($term->name, 'taxonomy/term/'. $term->tid);
  }
}

so Yes!, i believe its areal useable issue here!

drumm’s picture

Setting status to patch.

+1 for what is here and another request:

The image and forum modules should be able to make the links go to the image and forum modules. Although this could easily fit into http://drupal.org/node/10425.

Eric Scouten’s picture

The image and forum modules should be able to make the links go to the image and forum modules.

I strongly agree here.

Related suggestion: I'd like it if taxonomy_menu could "hijack" the term listings so that clicking on a term caused the menus to update properly. (IOW, the term link should be to taxonomy_menu/(vid)/(tid), not to taxonomy/(tid). This may or may not fit with the patch provided here. (I didn't read the patch.)

moshe weitzman’s picture

i guess folks want image and forum links to be rewritten because thos modules output their nodes using a display that differs from node/x. that is image/x looks different from node/x.

the right way to fix that is to do what we did for book.module. unify the look of image/x and node/x such that we no longer have an imagex. see how book.module accomplishes this.

i am still -1 for this patch since i see many other types of links that could be themed in this way (users, forum nodes, recipe nodes, polls, etc.). on the other hand, it is a pretty small change.

moshe weitzman’s picture

i guess folks want image and forum links to be rewritten because thos modules output their nodes using a display that differs from node/x. that is image/x looks different from node/x.

the right way to fix that is to do what we did for book.module. unify the look of image/x and node/x such that we no longer have an imagex. see how book.module accomplishes this.

i am still -1 for this patch since i see many other types of links that could be themed in this way (users, forum nodes, recipe nodes, polls, etc.). on the other hand, it is a pretty small change.

Eric Scouten’s picture

No, false assumption. There is no image/x URL for displaying a single image. The issue is not how to display a single node (we all agree that node/x is correct), but how to display a list of nodes. For certain kinds of nodes, there are far better ways to do it than offered by taxonomy_render_nodes, so it makes sense to allow an override of that list display. (Note: This is straying from the original discussion. If I didn't have to leave ASAP, I'd start a new thread.)

Bèr Kessels’s picture

bringing this back to the original discussion: pass the taxonomy links trough a theme function, so that people can, for example, add icons to the links. The patch sill applies (hint,hint!)

moshe weitzman’s picture

Perhaps we do this themeing not for every taxo link but rather for lists of links. In other words, do like theme_node_list() and theme_user_list(). more consistent with existing practice.

killes@www.drop.org’s picture

What did the usability meeting say about this?

Anonymous’s picture

What did the usability meeting say about this?
Nothing. Has not been discussed there.

I personally still think that *all* HTML should pass through a theme function, and so should this listing. And no, passing it trough one of the two listing theme functions is not a good idea. Because this is not suc a list.
This is the list of terms that show up with a node. Not a list that shows up in blocks or boxes! Its useage is completely different from these listings.

Bèr

Bèr Kessels’s picture

Nearly two months since the patch. If there is no need for this I will mark it won't fix.

Kobus’s picture

Hi,

If you look at my site Humour Authority (www.humourauthority.com) you'll see that I have images instead of the term names as a link. This cost me to hardcode taxonomy module so that it works. It is very neat if I can theme it by means of an extra function in my theme, so I am for the principle of allowing the theming hereof. I didn't look at the patch, and can't comment on it, or even if the patch will allow what I did on HA, but still, the idea (as I see it) is not much different. I give this patch a +1.

Kobus

Dries’s picture

I'm opposed to this patch. We can fix this changing the way we deal with links. (Think 'read more' link problem.)