Last active
July 17, 2018 12:38
-
-
Save nelson-ph/4fa87b84c352397be5723dcd4be1885a to your computer and use it in GitHub Desktop.
Drupal Password legacy module - fix $roles value on submit
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Index: password_policy.module | |
| IDEA additional info: | |
| Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP | |
| <+>UTF-8 | |
| =================================================================== | |
| --- password_policy.module (date 1531830899000) | |
| +++ password_policy.module (date 1531830899000) | |
| @@ -170,6 +170,10 @@ | |
| } | |
| $roles = $form_state->getValue('roles'); | |
| + if (!empty($roles) && !isset($roles[0])) { | |
| + $roles = array_filter($roles); | |
| + $roles = array_keys($roles); | |
| + } | |
| if (empty($roles)) { | |
| // Get if from $form; form state is always empty the first time. | |
| $roles = $form['account']['roles']['#default_value']; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment