Hello,

here's the patch that extends functionality of this module, I've noticed similar requests here and personally needed some options.

This patch adds following:

- Filtering display of terms per role basis, which is different of existing Display style: none (hidden) which if chosen hides terms for everyone, including admin.
- Limit display of terms for chosen content types, handy if one needs some content type to be tagged with certain terms but still not want to display those on node pages but for instance on views or similar. This depends of Vocabulary settings for content types - only those can be affected.
- Three more display styles:
parents which displays terms in parent->child order no matter of vocabulary or terms weight, might be useful for huge number of terms to avoid batch changing of weights etc.
nodelinks displays links to other nodes which are related with actual one by same term(s), logically doesn't show link to actual one though.
plain displays only terms' names, not links

Note that there is term_display.install patch too as I made it with two more table fields.
I am not sure if this is proper approach and also if field type 'text' is ok for types and roles.

Issues or TODOs ?
-- content type options (select list ) - would be better to holds only ones that are checked for vocabulary itself didn't figure how to make it ...
-- maybe to make option for term synonyms instead of terms' names?

Thanks in advance for testing or any suggestions, response.
Nenad

CommentFileSizeAuthor
#5 term_display.patch9.16 KBnk_
term_display_install.patch865 bytesnk_
term_display.patch12.59 KBnk_
Support from Acquia helps fund testing for Drupal Acquia logo

Comments

joachim’s picture

Regarding filtering term by role, http://drupal.org/project/taxonomy_role does this already. It's best not to duplicate functionality of another module.

nedjo’s picture

Title: Filter by roles and content types + three additional display styles » Three additional display styles
Status: Needs review » Needs work

Thanks for the patch! The new display options look good.

If you could post a patch just for the three additional display styles, that would be great. I don't want to add filtering to this module--I agree with joachim, that's best handled elsewhere.

Please use double spaces instead of tabs for indenting.

nk_’s picture

thanks for feedback!

@joachim:
I don't think it is the same functionality. Taxonomy role module filters terms on node (editing) forms, so certain roles who have permission to edit particular content still can't edit it's taxonomy. Here is the visibility matter on node displays, for instance if you have certain vocabulary that you want displayed only for admin (and/or some other roles) but not for all. On the other hand I agree not to duplicate functionality and I also use taxonomy role for its purpose and I don't feel comfortable having too many modules on.
Am I right on this? and if so is there other solution for this case. Or I didn't figure Taxonomy role's in complete:(

For the filtering by content type, it's really rare case and not quite functional (for real would need too many relations) so I also think not needed for this module. This was rather like a possibility suggestion ...

@nedjo: I will gladly post patch with only styles later today, but please also consider roles filtering once again (if I am right that taxonomy role doesn't do that).

Thanks again, Nenad

nedjo’s picture

@nk_: I'm looking forward to the new patch, thanks.

Re roles, this is probably covered by http://drupal.org/project/vocabperms and/or http://drupal.org/project/taxonomy_hide. If not, it could go in one of those modules.

nk_’s picture

FileSize
9.16 KB

Ok, here is the new patch, styles only. Hopefully no tabs ...

Note I added variable $limit in helper function for nodelinks style. This gives possibility to customize number of results from database on theme level. Initially it was set to 10 but maybe someone wants more or limit to less ... let me know what do you think about this.
And as additional instruction here is the one theme override example for it, I use it to display first 'nodelink' different than the rest ones and to limit number of links.

function phptemplate_term_display_nodelinks($vocabulary, $terms, $node_title) {
  $limit = 6;   // note default is 10
  $links = array();
  $links =  _term_display_related_nodes ($vocabulary, $terms, $node_title, $limit);
  foreach($terms as $term) {
    $links[0] = l($term->name, taxonomy_term_path($term));
    if(count($links) > 1) {
      for($i = 1; $i < count($links); $i++){
        $output[] =  $links[$i];
      }
      return '<br />'. $links[0] .' &rarr; <span class="small">' . implode(' | ', $output) .'</span><br />';
    }else{
      return '<br />'.implode(', ', $links) .'<br />';
    }
  } 
}

TODOs (maybe?)

- Views support
-- how's that possible anyway? with hook_views_data?

- Synonyms
-- do you think it is worth to try? This can be done in theme too using taxonomy_get_synonyms but not so precise in terms which synonym to use or so...

Ok for roles filtering, thanks for suggestions Nedjo I'll look in those modules but I hope I won't need 3-4 modules in total for managing terms. I also use Taxonomy role for its purpose maybe to try with patch there (seems like logical) and than have only 2 modules :)

Cheers, Nenad

nedjo’s picture

Apologies, I haven't found time to review this.

If someone could review and test I'd appreciate it.

big67’s picture

Hello

I tested the patch: it seems to work, at least using the "plain" mode.
(I use 7 different vocabolaries on my site)

The vocabs are printed also on the truncated - teaser version of the nodes: is this by design?

To be honest, I applied the patch manually, but think to have done everything correctly.

regards

Big

rstamm’s picture

Version: 6.x-1.0 » 6.x-1.x-dev

Please split into separate patches. It's easier then to review.