function ProfileForm::save

Same name in other branches
  1. 9 core/modules/user/src/ProfileForm.php \Drupal\user\ProfileForm::save()
  2. 10 core/modules/user/src/ProfileForm.php \Drupal\user\ProfileForm::save()
  3. 11.x core/modules/user/src/ProfileForm.php \Drupal\user\ProfileForm::save()

Overrides EntityForm::save

File

core/modules/user/src/ProfileForm.php, line 34

Class

ProfileForm
Form handler for the profile forms.

Namespace

Drupal\user

Code

public function save(array $form, FormStateInterface $form_state) {
    $account = $this->entity;
    $account->save();
    $form_state->setValue('uid', $account->id());
    $this->messenger()
        ->addStatus($this->t('The changes have been saved.'));
}

Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.