You are here

public function UserPermissionsForm::submitForm in Drupal 10

Same name and namespace in other branches
  1. 8 core/modules/user/src/Form/UserPermissionsForm.php \Drupal\user\Form\UserPermissionsForm::submitForm()
  2. 9 core/modules/user/src/Form/UserPermissionsForm.php \Drupal\user\Form\UserPermissionsForm::submitForm()

Form submission handler.

Parameters

array $form: An associative array containing the structure of the form.

\Drupal\Core\Form\FormStateInterface $form_state: The current state of the form.

Overrides FormInterface::submitForm

File

core/modules/user/src/Form/UserPermissionsForm.php, line 226

Class

UserPermissionsForm
Provides the user permissions administration form.

Namespace

Drupal\user\Form

Code

public function submitForm(array &$form, FormStateInterface $form_state) {
  foreach ($form_state
    ->getValue('role_names') as $role_name => $name) {
    user_role_change_permissions($role_name, (array) $form_state
      ->getValue($role_name));
  }
  $this
    ->messenger()
    ->addStatus($this
    ->t('The changes have been saved.'));
}