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.
Problem/Motivation
The default value handling for the field widget form uses '#default_value' => (isset($items[0]) && isset($items[0]['value'])) ? $items[0]['value'] : 1,
which causes the checkbox always being activated and preventing the field's default value being an unchecked state.
Proposed resolution
Use proper default value handling, using the field value, if present, and the field instance's configured default value: '#default_value' => (isset($items[$delta]) && isset($items[$delta]['value'])) ? $items[$delta]['value'] : $instance['default_value'][$delta],
Remaining tasks
Write a patch, review, commit.
Comment | File | Size | Author |
---|---|---|---|
#1 | socialshareprivacy-incorrect_default_value_handling-2532894-1-D7.patch | 671 bytes | minax.de |
Comments
Comment #1
minax.de CreditAttribution: minax.de commented