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.
| Comment | File | Size | Author |
|---|---|---|---|
| advpoll_choice_richtext.patch | 4.2 KB | anders.fajerson |
Comments
Comment #1
anders.fajerson commentedComment #2
Pibu commentedI 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!
Comment #3
anders.fajerson commentedPlease 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.
Comment #4
Pibu commentedExcuse me, wishfull thinking I guess. ;)
Comment #5
ChrisKennedy commentedIt 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 </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.
Comment #6
anders.fajerson commentedThis 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.
Comment #7
ChrisKennedy commentedAh gotcha - sorry, I was operating on far too little sleep to be reviewing patches.
Tested it and it seems great.
Comment #8
anders.fajerson commentedThanks for the review Chris. Commited with fixed typo.
Comment #9
anders.fajerson commentedFeel free to make a patch against 4.7 :)
Comment #10
anders.fajerson commentedForgot to change status.
Comment #11
anders.fajerson commentedI 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.
Comment #12
(not verified) commentedComment #13
knalstaaf commentedThis 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.
Comment #14
lubwn commentedIt 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.