Active
Project:
Advanced Taxonomy Blocks (abandoned)
Version:
6.x-3.5
Component:
Code
Priority:
Normal
Category:
Feature request
Assigned:
Unassigned
Reporter:
Created:
4 Dec 2010 at 11:42 UTC
Updated:
7 Mar 2011 at 11:58 UTC
Hi,
Thanks for the super module!
I have modified the module slightly so that the taxonomy terms link to the associated node pages, rather than to taxonomy term pages.
Warning! There are two versions of the Node Auto Term module. The original "NAT" and "NAT_NG" I used the second module because it has a bugfix I need. This means the function name "nat_ng_get_nids()" is slightly different from the original "nat_get_nids()".
Here is the code starting at line 915 in taxonomyblocks.module.
Sorry, I haven't worked out how to create a patch yet.
$termname = db_result(db_query("SELECT name FROM {term_data} WHERE tid = %d", $tid));
// customization - get the node id associated with this taxonomy term
$natnid = array_keys(nat_ng_get_nids(array($tid)));
// end customization
if (function_exists('tt')) {
$termname = tt('taxonomy:term:'. $tid .':name', $termname);
}
$tree[$termname]['link']['tid'] = $tid;
$tree[$termname]['link']['path_pattern'] = $pathpattern;
$tree[$termname]['link']['editaccess'] = 'administer taxonomy';
$tree[$termname]['link']['editpath'] = 'admin/content/taxonomy/edit/term/'.$tid;
$tree[$termname]['link']['edit_text'] = t('Edit this term');
$hasnodes = '';
$hasnodes = term_has_nodes($tid, $nodecounter);
$count = '';
$path = str_replace('%tid', $tid, $pathpattern);
$path = str_replace('%termname', $termname, $path);
// customization - when token "%natnid" is used, replace with $natnid variable which is the Node Auto Term, node id
$path = str_replace('%natnid', $natnid[0], $path);
// end customization
if ($nid) {
Cheers,
Jim
Comments
Comment #1
trotskyicepick commentedHi Jim,
Not sure if this is the right place to post, but here goes anyway:
I have given this a try and the links in my taxonomy block still point to the taxonomy term page as they did before. I have configured NAT-ng to make NAT-ng terms in blog node views point to the associated node rather than the taxonomy page and done a sync. I have also tried the same with the standard NAT module.
Have I missed out a step somewhere? Do I need to reconfigure the path in the taxonomy block settings?
Thanks.