- ivnish Kazakhstan
@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.
- Assigned to ivnish
- Merge request !56Issue #2918437: Extend poll choices more then 255 characters → (Merged) created by ivnish
- 🇧🇪Belgium BramDriesen Belgium 🇧🇪
This would need a manual test with existing data to see how the upgrade goes. Haven't had time yet to do this.
- 🇧🇾Belarus krakenbite
I tested it manually. Works as expected.
Before: choice only 255 chars
After: text area, a lot of text
- 🇧🇪Belgium BramDriesen Belgium 🇧🇪
Thanks for you manual review @krakenbite!
Did you save data in the old format and then applied the patch/mr (to test the update hook so data is not lost/corrupted/...)?
- 🇧🇾Belarus krakenbite
Yes, I tested hook_update. All data is migrate correctly
-
bramdriesen →
committed fa976ad3 on 2.0.x authored by
ivnish →
Issue #2918437 by ivnish, krakenbite, bramdriesen: Extend poll choices...
-
bramdriesen →
committed fa976ad3 on 2.0.x authored by
ivnish →
Automatically closed - issue fixed for 2 weeks with no activity.