function _sharedemail_form_submit in Shared Email 8.2
Shared email custom submit handler.
If the user has access to be shown the message and the message applies, show it.
1 string reference to '_sharedemail_form_submit'
- sharedemail_form_user_form_alter in ./
sharedemail.module - Implements hook_form_FORM_ID_alter().
File
- ./
sharedemail.module, line 53 - Shared email module file.
Code
function _sharedemail_form_submit($form, FormStateInterface $form_state) {
// Do they have permission to see the message.
if (\Drupal::currentUser()
->hasPermission('access shared email message')) {
$users = \Drupal::entityTypeManager()
->getStorage('user')
->loadByProperties([
'mail' => $form_state
->getValue('mail'),
]);
if ($users !== NULL && count($users) > 1) {
$config = \Drupal::config('sharedemail.settings');
\Drupal::messenger()
->addWarning($config
->get('sharedemail_msg'));
}
}
}