Extend poll choices more then 255 characters

Created on 24 October 2017, over 6 years ago
Updated 10 March 2024, 4 months ago

A good feature for the poll module would be to change the types of choices for the HTML format. This way you can insert images, videos or any other choice for voting.

From text_field to text_format or textarea.

✨ Feature request
Status

Active

Version

2.0

Component

Code

Created by

πŸ‡§πŸ‡·Brazil guilhermevm

Live updates comments and jobs are added and updated live.
Sign in to follow issues

Comments & Activities

Not all content is available!

It's likely this issue predates Contrib.social: some issue and comment data are missing.

  • ivnish Poland

    @Berdir, @BramDriesen I want to discuss this feature. I have a client which is using Poll module to create photo competitions :)

    He adds some code to choices:

    <div class="photoswipe-gallery">
    <a href="/sites/default/files/2023/10/27/pexels-craig-adderley-1563356_0.jpg" class="photoswipe" data-size="1024x682"><img src="/sites/default/files/styles/thumbnail/public/2023/10/27/pexels-craig-adderley-1563356_0.jpg" loading="lazy" width="100" height="60">
    </a>
    <a href="/sites/default/files/2023/10/27/pexels-isabella-mendes-341013_0.jpg" class="photoswipe" data-size="1024x678"><img src="/sites/default/files/styles/thumbnail/public/2023/10/27/pexels-isabella-mendes-341013_0.jpg" loading="lazy" width="100" height="60">
    </a>
    </div>
    

    Now we can add HTML to choices, but only 255 symbols.

    I changed choice field from

    $fields['choice'] = BaseFieldDefinition::create('string')

    to

    $fields['choice'] = BaseFieldDefinition::create('string_long')

    And PollChoiceDefaultWidget from

    '#type' => 'textfield',

    to

    '#type' => 'textarea',
    '#rows' => 1,
    

    It looks like

    Of course we need to update existing field definition.

    Is there any chance to add feature to mainstream if I make a patch?

  • Issue was unassigned.
  • πŸ‡§πŸ‡ͺBelgium BramDriesen Belgium πŸ‡§πŸ‡ͺ

    I've been thinking about this for a bit and I think we first need to check #3042995: Convert votes into entities β†’ . It would also be nice to put CKEDITOR 5 on the poll question field so we could also allow for some markup like bold or italic text. I think I've seen another issue about this but can't find it at the moment.

Production build 0.69.0 2024