[drupal-devel] [feature] introducing theme_term_link()

Kobus drupal-devel at drupal.org
Wed May 18 13:49:44 UTC 2005


Issue status update for http://drupal.org/node/12154

 Project:      Drupal
 Version:      cvs
 Component:    taxonomy.module
 Category:     feature requests
 Priority:     normal
 Assigned to:  Anonymous
 Reported by:  Bèr Kessels
 Updated by:   Kobus
 Status:       patch

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




Kobus



Previous comments:
------------------------------------------------------------------------

October 26, 2004 - 22:40 : Bèr Kessels

Attachment: http://drupal.org/files/issues/drupal_84 (1.28 KB)

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.




------------------------------------------------------------------------

October 27, 2004 - 00:02 : moshe weitzman

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




------------------------------------------------------------------------

October 27, 2004 - 00:25 : Bèr Kessels

I want it for one:

<?php
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:

<?php
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!




------------------------------------------------------------------------

October 27, 2004 - 02:12 : drumm

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.




------------------------------------------------------------------------

October 27, 2004 - 07:50 : Eric Scouten

"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.)




------------------------------------------------------------------------

October 27, 2004 - 14:28 : moshe weitzman

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.




------------------------------------------------------------------------

October 27, 2004 - 14:30 : moshe weitzman

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.




------------------------------------------------------------------------

October 27, 2004 - 19:39 : Eric Scouten

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.)




------------------------------------------------------------------------

November 15, 2004 - 12:47 : Bèr Kessels

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!)




------------------------------------------------------------------------

November 15, 2004 - 17:24 : moshe weitzman

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.




------------------------------------------------------------------------

March 13, 2005 - 22:49 : killes at www.drop.org

What did the usability meeting say about this?




------------------------------------------------------------------------

March 14, 2005 - 15:16 : Anonymous

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




------------------------------------------------------------------------

May 18, 2005 - 15:39 : Bèr Kessels

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







More information about the drupal-devel mailing list