This has been discussed before: allowing HTML in choices text. This solution doesn't change the UI but simply introduces this as a "hidden" feature. The markup used is the one used for the description.

CommentFileSizeAuthor
advpoll_choice_richtext.patch4.2 KBanders.fajerson

Comments

anders.fajerson’s picture

Status: Active » Needs review
Pibu’s picture

Status: Needs review » Patch (to be ported)

I would really love this feature to be available/ported to the 4.7 drupal version. Someone out there who is willing to help me? Deeply appreciated!

anders.fajerson’s picture

Status: Patch (to be ported) » Needs review

Please don't change the status before it has been commited to 5.x. It should be trivial to port this to 4.7 after this patch has been reviewed and tested enough for 5.x.

Pibu’s picture

Excuse me, wishfull thinking I guess. ;)

ChrisKennedy’s picture

It seems like it will be a problem stripping the paragraph blocks if the WYSIWYG editor has inserted them and the user believes that there will be a break between paragraphs - don't you think? Maybe we should strip the <p> tag and replace the &lt/p> tag with two breaks?

It would be helpful to clarify why we need to strip paragraph tags in the first place - I presume it's because they are block-level and labels are inline? If so, are there other block tags that we need to remove? Or could we style the choice labels as a block so that we can keep the paragraphs?

Minor: there' s a typo "fucntion" in the doxygen of the _advpoll_choice_markup.

anders.fajerson’s picture

This code comment was meant to expalin it: "created by check_markup() when "Line break converter"-filter is used".

It shouldn't be any WYSIWYG editors in the choice field as it's just an input field, not an textarea. So the only situation when we would strip p-tags is when they are entered by hand by a user. We could write a regular expression which is more specific but as I see it's not needed, p-tags shouldn't be there. The same goes for other block elements. The stripping isn't meant for cleaning up user submitted code but to remove p-tags inserted by the default filter when rendered.

ChrisKennedy’s picture

Status: Needs review » Reviewed & tested by the community

Ah gotcha - sorry, I was operating on far too little sleep to be reviewing patches.

Tested it and it seems great.

anders.fajerson’s picture

Thanks for the review Chris. Commited with fixed typo.

anders.fajerson’s picture

Version: 5.x-1.x-dev » 4.7.x-1.x-dev

Feel free to make a patch against 4.7 :)

anders.fajerson’s picture

Status: Reviewed & tested by the community » Patch (to be ported)

Forgot to change status.

anders.fajerson’s picture

Version: 4.7.x-1.x-dev » 5.x-1.x-dev
Status: Patch (to be ported) » Fixed

I just saw that it's now publicly stated on the project page that the 4.7 release is not supported. Hence I downgrade this to "fixed". Feel free to send in patches though for 4.7, I'm pretty sure bugfixes or simple features still can go in to the 4.7.x release.

Anonymous’s picture

Status: Fixed » Closed (fixed)
knalstaaf’s picture

Title: Rich text in choice field » HTML markup in poll option
Version: 5.x-1.x-dev » 7.x-3.x-dev
Issue summary: View changes
Status: Closed (fixed) » Active

This would still be useful in D7 (and D8). I'm looking for a way to use the Vimeo embed code as an option, for instance.

lubwn’s picture

It is not advised to edit the module directly and I can not provide a patch but if anyone stumble upon this thread looking for HTML markup in poll options, easiest way is simply removing strip_tags() function from line 591 of advpoll.module file. Certainly not the Drupal way but developing child module and altering the function somehow would take a lot more time.