Problem/Motivation
Steps to reproduce:
- Go to the module configuration page
- Choose
Consent by defaultmethod - Uncheck
Show "Cookie policy" and "More info" buttonsfield - Save the configuration
You will see, that the configuration takes effect in the frontend. But when you have a look at the module configuration form again, you will see, that the Show "Cookie policy" and "More info" buttons field again is checked, no regard of the settings you have saved and are working in the frontend.
That leads to the situation, that with the Consent by default method, you could always accidentally overwrite the setting of the Show "Cookie policy" and "More info" buttons field.
The issue seems to be related to the core issue: #2477053: Default_value overridden by form #states at page load. So the Javascript #states handling is processing, no matter if there was a #default_value or not and therefore always take precedence.
Proposed resolution
Simply remove the #states automatic checking of the field. The benefit is less, than the side-effect it could cause.
User interface changes
The Show "Cookie policy" and "More info" buttons field will not by always checked anymore, when using the Consent by default option.
Comments
Comment #2
szeidlerHere's a patch that solves the issue by removing the automatic checked #state.
Comment #3
svenryen commentedComment #4
svenryen commentedHere's the same patch for Drupal 8.
Comment #7
svenryen commentedFixed. Thanks!