Hi there,

after searching around quite a while and realizing that there seems to be a need for images, text ... to add to a poll choice, I decided to ask for the following feature.

So, how difficult would it be to replace the "Advanced Poll Choice" field by an entity containing fields?
field collection like!

Any idea? Someone who knows how to do it?

Greets ifux

Comments

Michele Wickham’s picture

Assigned: Unassigned » Michele Wickham

I'll think this over.

I know in v6 of the module people could insert images via markup, but my XSS meter goes off at that idea, particularly since the same field is used for write-ins and should be very well sanitized. Hence, when I created the field, I locked it down.

I can't really dump the poll field widget as it manages a unique value and a write-in flag. Since it is CCK, it does already have an entity relationship. That said, I may be able to add an image/file field to the widget. If I made it optional and handled it so that it didn't print out to the template when not present, it shouldn't screw up anyone's existing polls. And the other benefit would be that I could allow front-end developers to use their own imagecache settings - perhaps pushing it out to a separate image bar template rather than the normal bar template.

I've not added an image field to a custom cck/compound field widget but I can't imagine it'd be too much more difficult than handling files via drupal's FAPI. I'll have a look at it - assuming that sounds like it would be a good work around.

Michele

jamatulli’s picture

I have the same need and have come across a system that I have full access to where fields including images have been added to the Advanced Poll module through some customization. I am trying to figure out how they did it right now. I need to get something up for a client by morning and I don't have access to the original developer who customized the module.

If anyone is interested I can send a copy of the modified version. I will update here.

skypce’s picture

hello jamatulli, i want add to advanced polls fields and not only the default choice text, i need add souncloud field as choice. If you can send me your modified version of module i will be very happy. Regards.

jamatulli’s picture

What I ended up doing was changing the field being used to a text area from a text box and then removing the functions that strip html tags in a couple places. This is not to be used if you are going to have any write-in votes because of security risks. It was a quick fix because we decided we needed a longer entry and formatting.

jordanmagnuson’s picture

There's this sandbox module (not sure of maintenance status or future) which allows for each poll choice to have an image associated with it:

http://drupal.org/sandbox/xandeadx/1871070