function role_expire_user_form_submit_validate in Role Expire 2.x
Same name and namespace in other branches
- 8 role_expire.module \role_expire_user_form_submit_validate()
Form validation handler invoked by user_register_form and user_form alter hooks.
Allows to get and save the current roles of the user before the new user data is actually saved. By doing this, in the submit method we can ensure role expire data consistency.
https://drupal.stackexchange.com/questions/200620/insert-a-value-to-form...
1 string reference to 'role_expire_user_form_submit_validate'
- role_expire_form_user_form_alter in ./
role_expire.module - Implements hook_form_FORM_ID_alter().
File
- ./
role_expire.module, line 140 - Role Expire module.
Code
function role_expire_user_form_submit_validate($form, FormStateInterface &$form_state) {
$account = $form_state
->getFormObject()
->getEntity();
$original_roles = $account
->getRoles();
$form_state
->set('original_roles', $original_roles);
}