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.

Comments

we241’s picture

I've also been trying to figure this out.

ramsamba’s picture

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

Island Dave’s picture

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.

zilla’s picture

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 ;)

ckreutz’s picture

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.

zilla’s picture

@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?

kbahey’s picture

@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.

ckreutz’s picture

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.

adrapper’s picture

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

Apollo610’s picture

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.

pomliane’s picture

Status: Active » Closed (won't fix)

This version of Flag content is not supported anymore. The issue is closed for this reason.
Please upgrade to a supported version and feel free to reopen the issue on the new version if applicable.

This issue has been automagically closed by a script.