diff --git a/core/modules/contact/lib/Drupal/contact/MessageFormController.php b/core/modules/contact/lib/Drupal/contact/MessageFormController.php index 6f73d96..59e4e0c 100644 --- a/core/modules/contact/lib/Drupal/contact/MessageFormController.php +++ b/core/modules/contact/lib/Drupal/contact/MessageFormController.php @@ -61,9 +61,8 @@ public function form(array $form, array &$form_state) { $form['mail']['#markup'] = check_plain($user->mail); } - // The user contact form only has a recipient, not a category. - // @todo Convert user contact form into a locked contact category. - if ($message->recipient instanceof User) { + // The user contact form has a preset recipient. + if ($message->isPersonal()) { $form['recipient'] = array( '#type' => 'item', '#title' => t('To'), @@ -159,7 +158,7 @@ public function save(array $form, array &$form_state) { $params['contact_message'] = $message; $params['sender'] = $sender; - if ($message->category) { + if (!$message->isPersonal()) { // Send to the category recipient(s), using the site's default language. $category = entity_load('contact_category', $message->category); $params['contact_category'] = $category; @@ -185,14 +184,14 @@ public function save(array $form, array &$form_state) { } // If configured, send an auto-reply, using the current language. - if ($message->category && $category->reply) { + if (!$message->isPersonal() && $category->reply) { // User contact forms do not support an auto-reply message, so this // message always originates from the site. drupal_mail('contact', 'page_autoreply', $sender->mail, $language_interface->langcode, $params); } \Drupal::service('flood')->register('contact', config('contact.settings')->get('flood.interval')); - if ($message->category) { + if (!$message->isPersonal()) { watchdog('contact', '%sender-name (@sender-from) sent an e-mail regarding %category.', array( '%sender-name' => $sender->name, '@sender-from' => $sender->mail,