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.
The function system_settings_form()
will save variables into the variables table, but there is also a submit handler here that adds additional variables into the variables table (this time with properly prefixed names).
Additionally, what we're doing in the submit handler is validating, changing the values, and if the input isn't accurate, we're changing them back. Instead of doing this in the submit handler, let's add a validation handler instead, and only allow the values to be changed if they are correct.
Comment | File | Size | Author |
---|---|---|---|
#3 | login_redirect-settings_form_cleanup-2431147-3.patch | 2.97 KB | perennial.sky |
| |||
#2 | login_redirect-settings_cleanup-2431147.patch | 2.97 KB | jenlampton |
Comments
Comment #1
jenlamptonComment #2
jenlamptonComment #3
perennial.sky CreditAttribution: perennial.sky as a volunteer commentedIt is better to use #element_validate to check particular form element value instead of using form validate.
Here is the patch
Comment #6
perennial.sky CreditAttribution: perennial.sky as a volunteer commented