Closed (fixed)
Project:
Flag Terms
Version:
6.x-1.0-beta2
Component:
Code
Priority:
Normal
Category:
Support request
Assigned:
Unassigned
Reporter:
Created:
5 Jan 2010 at 20:59 UTC
Updated:
5 Jan 2012 at 11:28 UTC
I have a views block on a node page using a term argument to generate a list of nodes.
How do I generate a flag link for that term that that the views is based on? I would like to put it in the views header or in the a block somewhere.
Thanks.
Comments
Comment #1
tayzlor commentedHi There,
if the page is not a taxonomy term page then you would need to use the flag API to create a flag link for the term.
You can do this using the flag_create_link($flag->name, $term->tid); function.
Here's some more documentation on how you can place a flag link on a page - http://drupal.org/node/295383
Comment #2
ManyNancy commentedDo you need to load the term first? This is not working for me.
Comment #3
ManyNancy commentedNevermind, it works well :). (cache problems)
Do you know how to add classes to the link?
Thanks.
Comment #4
ManyNancy commentedComment #5
tayzlor commented@Minqensan,
there is a flag.tpl.php inside the flag folder which renders the html for the flag link. You can add classes to it here (or in a template preprocess function for the flag.tpl file.
issue fixed so setting this to closed.
Comment #6
amsterdamdrupalnewbie commentedHow would I get this to work with version 7.x-1.x-dev? I have tried using the following, in a block, and limiting it to taxonomy pages:
print flag_create_link('like', $term->tid);where 'like' is the machine name of my flag, but it returns an error.