There's a little-known feature with core checkboxes and radios: you can set descriptions on the individual elements. (See #2779999: Document checkboxes and radios element can have individual descriptions for details.)

This ought to be possible here too. All it takes is for the processing not to clobber what might be there already when it creates the subelements.

Patch coming.

Support from Acquia helps fund testing for Drupal Acquia logo

Comments

joachim created an issue. See original summary.

joachim’s picture

Version: 8.x-3.x-dev » 8.x-1.x-dev
Status: Active » Needs review
FileSize
1007 bytes

Here's the patch.

joachim’s picture

This allows:

        $element['select']['normal option']['#description'] = 'description on a normal option checkbox/radios';
        $element['select']['select_or_other']['#description'] = 'description on the "other" checkbox/radio';
        $element['other']['#description'] = 'description on the "other" textfield';
legolasbo’s picture

Status: Needs review » Needs work
Issue tags: +Needs tests

This needs some tests to prevent regressions.