Support for Drupal 7 is ending on 5 January 2025—it’s time to migrate to Drupal 10! Learn about the many benefits of Drupal 10 and find migration tools in our resource center.
<matt2000> anybody know how to set the 'on' label for Field API list_boolean checkbox widget? I've tried a couple variations on
<?php $field['settings']['allowed_values'] = array(0 => 0, 1 => $label); ?>
<crickets> chirp, chirp.
<matt2000> oh, of course. "0\n1|$label" :-P
<matt2000> DX: fail
Comment | File | Size | Author |
---|---|---|---|
#2 | options_array.patch | 1.61 KB | matt2000 |
#1 | options_array.patch | 1.61 KB | matt2000 |
Comments
Comment #1
matt2000 CreditAttribution: matt2000 commentedComment #2
matt2000 CreditAttribution: matt2000 commentedDoc fix
Comment #3
moshe weitzman CreditAttribution: moshe weitzman commentedWe made some minor changes to boolean Field. Not sure if this changed tho.
Comment #4
thedavidmeister CreditAttribution: thedavidmeister commentedThe code for this looks very similar in d8 and there's certainly no "is_array()" check so I'm bumping the version number.
New code can be found in \Drupal\options\Type\ListItemBase.
I understand the string syntax for this field type is a bit weird DX, but field config like this is usually coming from a "site builder" scenario, so I don't know the use case for this purported DX improvement.
Could we get an issue summary update with an example of when you might want to use this feature "in the wild"?