Hello,

Is it possible to have the 'Flagged message:' text show only in the message area even when JavaScript is enabled?
The flagged message does not look too good showing below the link in the views I have setup, and I would like it to show in the message area if possible.

Thank you very much in advance!

Flag Settings
Flagged message: [text]
Message displayed after flagging content. If JavaScript is enabled, it will be displayed below the link. If not, it will be displayed in the message area.

Comments

quicksketch’s picture

Generally this is not possible, since Flag does not know where on the page the message area is. Due to differences in themes, the markup and position for the message area is hard to predict. You might look into implementing a custom JavaScript action after a flagging has occurred, since you know what HTML your particular theme outputs. See the handbook page on executing custom actions after flagging.

Bilmar’s picture

Thank you for the quick post!

I would like to add a little more info to clarify my original post above.

At the settings page, if [Display option: => Link type:] is set to [Normal link] the flag message shows in the $messages on the page. (i like!)
I like the [JavaScript toggle] setting because the Add Flag/Remove Flag changes on the Views via javascript without a page refresh.
BUT (what my comment is concerned with) I still want the flag message to go through the $messages on the page and not underneath the link.

I was thinking that the javascript toggle and the flag messages options should be separated instead of linked to one another as it seems now.

May I confirm if your understanding in my original post and your comment @#1 doesn't change with this additional info?

Thanks quicksketch!

quicksketch’s picture

Yes that's right, you can use the JavaScript APIs to put the message into the message area after flagging through JavaScript. The options won't be separate from each other since (as I noted in #1) it's difficult for JavaScript to know where the message area should appear depending on your theme.

Bilmar’s picture

awesome, thanks for taking the time to explain quicksketch!
I will study the Flag API and try to learn how to get it to work.

I just started learning how to program and just getting comfortable with basic theming of drupal using template.php and .tpl.php files, so if anyone comes across this thread and can paste any examples or pointers for the community (and me) it would be very much appreciated!

quicksketch’s picture

Status: Active » Closed (fixed)