diff --git a/rest_feedback_endpoint.module b/rest_feedback_endpoint.module index 8cf801f..727beb4 100644 --- a/rest_feedback_endpoint.module +++ b/rest_feedback_endpoint.module @@ -10,7 +10,7 @@ function rest_feedback_endpoint_mail($key, &$message, $params) { switch ($key) { case 'rest_feedback_endpoint': - $message['subject'] = t('Crow interface bug report: @title', ['@title' => $params['title']], $options); + $message['subject'] = t('@title', ['@title' => $params['title']], $options); $message['body'][] = $params['message']; break; } diff --git a/src/Form/Settings.php b/src/Form/Settings.php index 75b31b5..0a5193d 100644 --- a/src/Form/Settings.php +++ b/src/Form/Settings.php @@ -49,6 +49,12 @@ public function buildForm(array $form, FormStateInterface $form_state) { '#description' => $this->t('Single email only'), '#default_value' => $config->get('notification_email'), ]; + $form['subject_line_prefix'] = [ + '#type' => 'textfield', + '#title' => $this->t('Subject line prefix'), + '#description' => $this->t('Prepend the subject line of the email (e.g. "Mysite user feedback: ".'), + '#default_value' => $config->get('subject_line_prefix'), + ]; return parent::buildForm($form, $form_state); } @@ -60,6 +66,7 @@ public function submitForm(array &$form, FormStateInterface $form_state) { $this->configFactory->getEditable(static::SETTINGS) ->set('on', $form_state->getValue('on')) ->set('notification_email', $form_state->getValue('notification_email')) + ->set('subject_line_prefix', $form_state->getValue('subject_line_prefix')) ->save(); parent::submitForm($form, $form_state); } diff --git a/src/Plugin/rest/resource/SubmitIssue.php b/src/Plugin/rest/resource/SubmitIssue.php index 6cb8de9..f819375 100644 --- a/src/Plugin/rest/resource/SubmitIssue.php +++ b/src/Plugin/rest/resource/SubmitIssue.php @@ -94,7 +94,7 @@ public function post($data) { $module = 'rest_feedback_endpoint'; $key = 'rest_feedback_endpoint'; $to = $config->get('notification_email'); - $params['message'] = 'The user ' . $name . ' has reported an issue with the Crow web interface.' . PHP_EOL . PHP_EOL; + $params['message'] = 'The user ' . $name . ' has reported an issue with the interface.' . PHP_EOL . PHP_EOL; $params['message'] .= 'SOURCE PAGE: ' . $data['url'] . PHP_EOL . PHP_EOL; $params['message'] .= 'DESCRIPTION: ' . Html::escape($data['description']) . PHP_EOL . PHP_EOL; $params['message'] .= 'USER ACCESS LEVEL: ' . implode(', ', $reported_roles) . PHP_EOL . PHP_EOL; @@ -106,7 +106,7 @@ public function post($data) { else { $params['message'] .= 'CONTACT USER WITH UPDATES ABOUT THE ISSUE: no' . PHP_EOL . PHP_EOL; } - $params['title'] = Html::escape($data['title']); + $params['title'] = $config->get('subject_line_prefix') . Html::escape($data['title']); $langcode = \Drupal::currentUser()->getPreferredLangcode(); $send = TRUE; $response_status['status'] = $mailManager->mail($module, $key, $to, $langcode, $params, NULL, $send);