Closed (fixed)
Project:
Flag
Version:
6.x-1.3
Component:
Flag core
Priority:
Normal
Category:
Support request
Assigned:
Unassigned
Reporter:
Created:
31 May 2010 at 14:38 UTC
Updated:
23 Jun 2010 at 17:20 UTC
Hello,
I'm doing a custom theme where the area to flag my content and the area to add comments are on separate parts of the page. On some nodes I don't even allow comments. I really don't want my flag links lumped into the $links array. Is there a way to create a $flag_links array (separate menu) or, how can I remove the Add Comments link from the links array? I'd prefer the first option. Thanks for your thoughts,
Blue
Comments
Comment #1
quicksketchYou can simply not enable the flag link when you configure the flag. Then you can use flag_create_link() to place the link wherever you want. See http://drupal.org/node/295383.
Comment #2
blue92877 commentedHey, that works great! Thanks for the reply.
I'm not very good with PHP, but would it be possible to extend the functionality above by having PHP count the number of custom flags I have created, add them to an array, and spit them back out as an HTML list?
count_number_of_custom_flags();
while(number_of_flags) {
print flag_create_link("flag_name[number_of_flags]);
}
Sorry for the quick pseudocode, but hopefully it's enough to illustrate my point. The above solution works great and so is the article, but I'd hope to create a situation where any additional flags were automatically added to the results.
Thanks!
Comment #3
quicksketchYes, you can do this simply by using flag_get_flags() and then looping through them and printing out the links. I don't provide support on custom coding in the issue queue though, so your exact code is something you'll have to figure out.
Comment #4
blue92877 commentedThat did exactly what I needed! Thanks!
Here is the code I created in case anyone else has the same issue. Based on the above suggestion of not enabling the flag link, this function will allow you to put your list of flags wherever you want on your page:
Use CSS to style and voila, you have your own custom flags menu!
Comment #5
quicksketchSuper, sounds like we can mark this fixed.