Hello,
i'd need to add some descriptions for single options in checkboxes or radios elements. Just found out it is possible in forms thanks to this: https://www.drupal.org/node/2531656.
i read this was already suggested and closed https://www.drupal.org/node/1721998, but since the 8 version of Webform has changed a lot of things, well... why not trying again?
i think i can help with patches and code, would just like to have a couple hints on where to start from... Could anyone give me suggestions?
thanks!
| Comment | File | Size | Author |
|---|---|---|---|
| #11 | options_descriptions-2910504-11.patch | 144.69 KB | jrockowitz |
| #8 | options_descriptions-2910504-8.patch | 141.28 KB | jrockowitz |
| #6 | options_descriptions-2910504-6.patch | 141.28 KB | jrockowitz |
Comments
Comment #2
jrockowitz commentedThis is going to be really difficult to fully support. I am not exactly sure where to begin.
Comment #3
jrockowitz commentedI am so tempted to suggest we add a description delimiter that automatically generates a checkbox/radio description.
This is a "hacky" solution but very easy to implement and support.
...then we could take it a step further and support the help tooltip (ie '?' ) using a different delimiter.
Comment #4
jrockowitz commentedThe \Drupal\webform\Element\WebformElementOptions could be extended to support option descriptions.
I am leaning toward the YAML syntax being...
Comment #6
jrockowitz commentedComment #8
jrockowitz commentedComment #11
jrockowitz commentedComment #13
jrockowitz commentedI committed the patch. Adding descriptions or help text to checkboxes and radios is now fully supported. Please download the latest dev release to review.
Comment #15
joey-santiago commentedThanks a lot, works perfectly!
as i wanted them to go on a new line in stead of being "immersed" in the title text, i went this way:
1: added an element to the form_element_label.html.twig
2: used template_preprocess_form_element_label() to split the title by WebformOptionsHelper::DESCRIPTION_DELIMITER and extract my description
hope it can help others :)