function contact_user_profile_form_submit
Same name in other branches
- 9 core/modules/contact/contact.module \contact_user_profile_form_submit()
- 8.9.x core/modules/contact/contact.module \contact_user_profile_form_submit()
- 10 core/modules/contact/contact.module \contact_user_profile_form_submit()
Form submission handler for \Drupal\user\ProfileForm.
Saves the contact page setting.
1 string reference to 'contact_user_profile_form_submit'
- ContactHooks::formUserFormAlter in core/
modules/ contact/ src/ Hook/ ContactHooks.php - Implements hook_form_FORM_ID_alter() for \Drupal\user\ProfileForm.
File
-
core/
modules/ contact/ contact.module, line 14
Code
function contact_user_profile_form_submit($form, FormStateInterface $form_state) {
$account = $form_state->getFormObject()
->getEntity();
if ($account->id() && $form_state->hasValue('contact')) {
\Drupal::service('user.data')->set('contact', $account->id(), 'enabled', (int) $form_state->getValue('contact'));
}
}
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.