contact_user_profile_form_submit

contact_user_profile_form_submit($form, FormStateInterface $form_state)

Submit callback for the user profile form to save the contact page setting.

File

core/modules/contact/contact.module, line 192
Enables the use of personal and site-wide contact forms.

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'));
  }
}
doc_Drupal
2016-10-29 08:56:33
Comments
Leave a Comment

Please login to continue.