function private_message_user_form_submit in Private Message 8
Same name and namespace in other branches
- 8.2 private_message.module \private_message_user_form_submit()
Custom submit handler, saves user settings for the private message module.
See also
private_message_form_user_form_alter()
1 string reference to 'private_message_user_form_submit'
- private_message_form_user_form_alter in ./
private_message.module - Implements hook_form_FORM_ID_alter().
File
- ./
private_message.module, line 380 - Contains hooks for the private message module.
Code
function private_message_user_form_submit(array &$form, FormStateInterface $form_state) {
// Get the user whose account object is being modified.
$user = $form_state
->getFormObject()
->getEntity();
$user_data = \Drupal::service('user.data');
// Save the submitted data to the user's UserData.
$user_data
->set('private_message', $user
->id(), 'email_notification', $form_state
->getValue([
'private_messages',
'email_notification',
]));
}