I'm using Acidfree for the photo gallery on one of my sites (www.maceiras-alentejo.co.uk) and when viewing an image there is a little icon and a link to the taxonomy type of the image displayed just above and to the left of the image itself as can be seen at www.maceiras-alentejo.co.uk/node/97

How do I either:

1. remove the image and link (preferable)
or
2. move them below the image?

Comments

nancydru’s picture

+1 for me. Except in the Garland theme they are below the image.

Dubber Dan’s picture

Ah, then that suggests it might be controlled within the theme and not the module....

Still need to know what to alter though ;-)

nancydru’s picture

It can be done in the theme. All I know is that you will see a "print $links" somewhere.

However, IMHO, it is better done on the module, but I am not the AcidFree developer. In a module that I wrote, I have an option to generate (or not) the links. I haven't looked at AcidFree, but I know how it can work in Drupal, and it would be harder (although fairle easy) to add the settings option than to actually do the code to do the links.

vhmauery’s picture

Status: Active » Closed (won't fix)

I agree that this is mildly annoying. However, until now I have not investigated it.

The links are generated by the Taxonomy module, not Acidfree. Since they aren't even part of the node->content that is found in nodeapi('view'), Acidfree can't even modify them there. The only way to get rid of them that I can think of would be to special case the view node theme so that for Acidfree types ('acidfree', 'image', 'video') you don't display the taxonomy links.

I am marking this as won't fix, but it is more of a "can't fix".

nancydru’s picture

Status: Closed (won't fix) » Postponed

Vernon, they should be visible in the hook_link_alter function. Something like this:

    if (strstr($module, 'taxonomy_term')) {
      if (variable_get('pinkslip_display_term_list', FALSE)) {  /* are we showing the terms? */
        // Link back to my display and not the taxonomy term page
        $tid = substr($module,14);
        $term = taxonomy_get_term($tid);
        $tname = $term->name;
        $links[$module]['href'] = "pinkslip/term/$tid";
        $links[$module]['attributes']['class'] = 'pinkslip_terms';
      } /* end if display_term */
     else { /* we don't want terms shown */
        $links[$module]['title'] = "";  /* we'll just blank it out */
      } /* end else */
    } /* end if taxonomy_term */

But, much easier is if you set the vocabulary as belonging to AcidFree ($vocabulary->module = 'acidfree'). That will cause the taxonomy module to call a hook_term_path in AcidFree rather than creating a taxonomy term link. You can then do whatever you wish with them.

vhmauery’s picture

Status: Postponed » Fixed

Right. I had forgotten about hook_link_alter. Thanks for reminding me. I just committed a fix for this. Basically, since it is an annoying feature, by default, the links are gone unless you elect to have them shown in Acidfree settings.

Committed to CVS.

nancydru’s picture

Oh, darn, I was hoping you'd take the hook_term_path approach... I'm itching to have an established contributed module use that because I have an issue open with the API documenters.

Dubber Dan’s picture

Great news!

Now all I need to do is figure out how to get it from the CVS to my site. Any pointers folks?

nancydru’s picture

It should be part of the 5.1-dev download tomorrow.

vhmauery’s picture

If you look at the diff, I actually implemented both hook_term_path and hook_link_alter. Oh. But I just realized that I forgot to modify the existing vocabulary with acidfree.install. But it looks like I am in time for the next scheduled tarball creation, so it should all be atomic from your point of view (unless you are using CVS).

But I implemented hook_term_path so the taxonomy links now look link back to the album node rather than the taxonomy term, so you should never see a link to the term listing of an album.

The hook_link_alter was required to actually remove the links. Even if hook_term_path returned null, the links still showed up, so I finally resorted to just deleting the taxonomy links that were from the Acidfree vocabulary.

nancydru’s picture

Hmm... I downloaded today (the May 14 version) and see the "Show category links in Acidfree node views" on the settings page, but it doesn't matter if I check or uncheck this. The links are still there. BTW, I am using the Garland theme.

nancydru’s picture

Status: Fixed » Active
vhmauery’s picture

Status: Active » Closed (fixed)

No, it works just like I wrote it. It gets rid of the Acidfree vocabulary category links. All other vocabularies still will show their links. The other vocabularies' categories *should* show up. The only real reason for removing the Acidfree vocabulary categories is because it is redundant with the breadcrumb links.

I just don't think it is right for Acidfree to run off and destroy ALL of the category links.

nancydru’s picture

Oh, I see. It's my TAC_Lite links that are showing...

nancydru’s picture

For those who wish to eliminate all taxonomy links, here's a snippet. I put this in another module's hook_link_alter just because it was easier to put it there.

  // this code is to eliminate TAC_Lite links in images - it really doesn't belong here
  $types = array('image' => 1, 'acidfree' => 1);  /* node types to examine */
  if (isset($types[$node->type])) {
    foreach ($links AS $module => $link) { /* destroy all taxonomy links */
      if (strstr($module, 'taxonomy_term')) { $links[$module] = array(); }
     }
   }
adaven’s picture

Thanks I found this post very useful. Just one point, some themes put text before the taxonomy term, such as "in" or "belongs to", which can still appear even when $links[$module] = array() A way to fix this is to call unset($links[$module]) instead.