function ContactFormHooks::profileFormSubmit
Provides an additional submit handler for \Drupal\user\ProfileForm form.
Parameters
array $form: The form render array.
\Drupal\Core\Form\FormStateInterface $form_state: The form state instance.
File
-
core/
modules/ contact/ src/ Hook/ ContactFormHooks.php, line 61
Class
- ContactFormHooks
- Form hook implementations for Contact module.
Namespace
Drupal\contact\HookCode
public function profileFormSubmit(array $form, FormStateInterface $form_state) : void {
$account = $form_state->getFormObject()
->getEntity();
if ($account->id() && $form_state->hasValue('contact')) {
$this->userData
->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.