Problem/Motivation
On #2779999: Document checkboxes and radios element can have individual descriptions it was pointed out that the sample code for checkboxes and radios form elements is culturally specific. @quietone wrote in the MR review:
I am concerned that both 'high_school' and 'SAT' are culturally specific and may not mean much to anyone outside of countries that have high schools and use the 'SAT' test. I spoke to xjm and she thought 'high_school' was acceptable and then reminded me of the controversy about the 'SAT' test being biased, such as racially, economically, and gender. Therefor, let's use a different example.
The current example code is:
* Usage example:
* @code
* $form['high_school']['tests_taken'] = array(
* '#type' => 'checkboxes',
* '#options' => array('SAT' => $this->t('SAT'), 'ACT' => $this->t('ACT')),
* '#title' => $this->t('What standardized tests did you take?'),
* ...
* );
* @endcode
*
* Element properties may be set on single option items as follows.
*
* @code
* $form['high_school']['tests_taken']['SAT']['#description'] = $this->t('Description for the SAT option.');
* @endcode
*
Proposed resolution
The terms used in the example code should be changed.
Remaining tasks
- Decide on what to use for an example
- Make a MR with the changes.
Issue fork drupal-3265929
Show commands
Start within a Git clone of the project using the version control instructions.
Or, if you do not have SSH keys set up on git.drupalcode.org:
Comments
Comment #2
lauriii#2779999: Document checkboxes and radios element can have individual descriptions has been committed.
Comment #3
joachim CreditAttribution: joachim as a volunteer commentedComment #4
joachim CreditAttribution: joachim as a volunteer commentedLet's start the bikeshed!
The obvious one seems to me to be 'What is your favourite colour?'
Comment #5
jonathanshawHow's this:
Comment #6
joachim CreditAttribution: joachim as a volunteer commentedLooks good!
Comment #8
jonathanshawComment #10
joachim CreditAttribution: joachim as a volunteer commentedLGTM!
Comment #12
xjmAdding credit for @quietone who brought this up with me originally.
Comment #16
xjmTagging "Needs followup" for:
Committed to 10.0.x and cherry-picked to 9.4.x. Thanks! I also backported it to 9.3.x as a patch-eligible documentation bugfix. (I had to backport #2779999: Document checkboxes and radios element can have individual descriptions first.)
Apologies to @joachim; I accidentally left off credit for your issue report in the commit message because I crossposted with myself when dealing with the backport blocker, but it's restored in the issue credit on the issue node here.
Comment #17
dww#3273865: Correct use of array() to [] in comments
Comment #18
dwwUgh, silly me. I should have searched first. #2874067: Fix Drupal.Commenting.DocCommentLongArraySyntax coding standard is the real followup that we didn't need. ;)