Change the "flag this" text link to an image?

cpract - August 21, 2007 - 20:45
Project:Flag content
Version:5.x-2.5
Component:Miscellaneous
Category:support request
Priority:normal
Assigned:Unassigned
Status:active
Description

How can I change the "flag this" text link to an image of choice? It would also be a great feature to add to future releases.

#1

we241 - August 27, 2007 - 01:54

I've also been trying to figure this out.

#2

ramsamba - October 3, 2007 - 18:16

Please also allow the "flag this" text to be changed.

i think this change has to be effected in 3 places:
1. before the content is "flagged": seen as "flag this"
2. admin sees flagged item: seen as "unflag"
3. other users see it; seen as "flagged"

thanks

#3

Island Dave - January 19, 2008 - 21:51

I've not prepared a full drupal integration, but a quick hack is the following:

in flag_content.module:

function flag_content_link .....

go down to

if (is_numeric($eid)) {
$options = array('class' => 'flag_content');

if (!_flag_content_check($eid, $type)) {
// Not already flagged, flag it for admin
$links['flag_content_add'] = array(
'title' => 'flag this',

Change 'title' and add the 'html' element:
'title' => '<img src="http://foo.example.com/files/dead_link.jpg" alt="Dead Link?" />',
'html' => TRUE,

Like I said, a quick hack, but effective if you need it in the short term. Would love to see this integrated properly into the module.

#4

zilla - March 25, 2008 - 02:33

thanks - i'm reluctant to edit the module file because there will eventually be an upgrade...

for now, those interested can use string override module to change flag this (text / system content) -it's very easy. but i too would like a simple image option built into the module with a standard icon recognizable for this type of thing (like an exclamation point or yellow triangle or something universal like that) - and it can be done with css, but why ;)

#5

ckreutz - January 18, 2009 - 20:47

I solved it differently and just added an background image in the standard theme CSS file.

.flag_content_add a{
background:url(path_to_theme/images/flag.gif) top left no-repeat;
padding:0 0 6px 13px;
}

This leaves the module untouched.

#6

zilla - October 8, 2008 - 11:41

@ckreutz - would this work for 'multiple images' (flag, unflag, etc)? also, could this be implemented with css injector module, or must this change happen directly in the theme's style sheet?

#7

kbahey - October 8, 2008 - 16:05

@ckreutz

Can you please document that in the README.txt and attach it to this issue?

I will then commit it, so people can get those instructions without having to search the issue queue.

#8

ckreutz - January 18, 2009 - 20:50

Sorry, I do not know whether it works with multiple images. Is there still a need to implement it to the readme.txt? Sorry forgot to look back here.

#9

adrapper - February 2, 2009 - 16:03

Very easy,

I just wanted to change the text not add an image. editing this file easy and worked.

Make a back up in case you make a boobo.

Andrew

#10

Apollo610 - February 4, 2009 - 21:33

If you just want to change the text, check out the String Overrides module.

It allows you to change most text without having to modify the modules directly.

 
 

Drupal is a registered trademark of Dries Buytaert.