Hi,

I would like to use the module to flag content which is also out of date as well as inappropriate. But I would like to change the 'Flag as offensive' link text to something else - in my case I run a site related to auto racing, so it would be something like 'Black Flag this page' . Its not very likely that my users will post something 'bad'.

I have changed the text within the module, but if it gets updated, I will have to redo the change. Is there a way to have the link text be part of the configuration?

Eric

CommentFileSizeAuthor
#4 241109-4-change_link_text.patch2.06 KBgreg.harvey

Comments

jaydub’s picture

The easy method for translating a small number of strings is via:

http://drupal.org/project/stringoverrides

The more complicated but comprehensive way is:

http://drupal.org/node/290
http://drupal.org/node/24593

There's no real good reason to make special translation cases for
the text in this module when you have the drupal solutions above
for any module's text.

aitala’s picture

Hm... never saw that module before.

Thanks,

Eric

jaydub’s picture

Status: Active » Closed (fixed)
greg.harvey’s picture

Version: 5.x-1.x-dev » 6.x-1.x-dev
Status: Closed (fixed) » Needs review
StatusFileSize
new2.06 KB

Far better to let people change this in admin, or make it a theme function. That's what the vast majority of modules do and for me it is more 'correct'. Patch attached. This is also a tidier solution for the icon requests you have been receiving.

Appreciate changes are set for the 2.x branch, but I'm using this module on a big corporate site and must use the 'recommended' version, so the patch has to be for the 'recommended' branch. Could be easily ported, I'm sure.

jcisio’s picture

Status: Needs review » Closed (won't fix)

Thanks for the patch, Greg. But I think the "correct" and easier way is to use what Drupal provides already. If you don't want to use #1, then modify your settings.php:

/**
 * String overrides:
 *
 * To override specific strings on your site with or without enabling locale
 * module, add an entry to this list. This functionality allows you to change
 * a small number of your site's default English language interface strings.
 *
 * Remove the leading hash signs to enable.
 */
$conf['locale_custom_strings_en'] = array(
   'Flag as offensive' => 'Black Flag this page',
);

You have the same liberty as with theming override.

greg.harvey’s picture

Hmmm, not really, no. Theming override allows all sorts of modifications. I can achieve what *I* want using your approach, but there are many other requests where people are having to get 'hacky' with CSS that this would resolve.

But anyway, you're the chief! If you won't commit this, then there's not much I can do. ;-)

dave reid’s picture

Um, the other proper way to alter this is using hook_link_alter() which can change a lot of things. Theme functions as a wrapper for t() is just silly.

greg.harvey’s picture

Title: Change link text » Change link text to something else (e.g. change text, change to an icon, etc.)

hook_link_alter() would to it.

However, I have two criticisms for this:

1. Themers would normally want to change this and themers don't often write modules, and shouldn't need to care about hooks. That's why theme functions and templates exist.

2. You are looking at it purely from the point of view this will always be text, which is not the case - there are other requests in the queue to make it an icon, etc. - your implication my theme function was solely to fix a text string issue is wrong.

Updated title, for what it's worth, but like I say - for some reason making this easier for themers is something people don't want to do, so there's nothing I can do and no point in continuing the discussion. I'm not sure why this is - it confounds me, frankly.

jcisio’s picture

I was saying the same liberty because, in fact, you can put whatever you want (html tags) in that variable.

In case that you want to put an icon, it's rather simple for themers. Just modify the class .flag-content in their CSS files to add an background image.

greg.harvey’s picture

Right, you *can* put HTML there, but you're not supposed to. Translation strings are meant to be clean of mark-up. So that in itself is a hack/misuse of the string translation system.

I'm not disputing you can achieve an icon, no text, etc. etc. with the current system. I'm just saying the mechanism (or mechanisms, as in some instances you have to poke the module in different places) is confused and not all that great. Dave's hook_link_alter point is fair enough, I totally forgot about it/failed to grok it was in $links, but as I pointed out above, that's no good for themers.

A theme function is dead easy. Every knows what it does, everyone can use it, everything is in one place...