function _comment_notify_submit_user_form in Comment Notify 8
Additional submit handler for the user form.
1 string reference to '_comment_notify_submit_user_form'
- comment_notify_form_user_form_alter in ./
comment_notify.module - Implements hook_form_alter().
File
- ./
comment_notify.module, line 302 - This module provides comment follow-up e-mail notifications.
Code
function _comment_notify_submit_user_form(array &$form, FormStateInterface $form_state) {
module_load_include('inc', 'comment_notify', 'comment_notify');
/** @var \Drupal\user\UserInterface $user */
$user = $form_state
->getFormObject()
->getEntity();
if (!$user
->isAnonymous() && is_numeric($form_state
->getValue('entity_notify')) && is_numeric($form_state
->getValue('comment_notify'))) {
/** @var \Drupal\comment_notify\UserNotificationSettings $user_settings */
$user_settings = \Drupal::service('comment_notify.user_settings');
$user_settings
->saveSettings($user
->id(), $form_state
->getValue('entity_notify'), $form_state
->getValue('comment_notify'));
}
}