diff --git a/src/Form/CommentNotifySettings.php b/src/Form/CommentNotifySettings.php index 3fe51b2..5dcf166 100644 --- a/src/Form/CommentNotifySettings.php +++ b/src/Form/CommentNotifySettings.php @@ -162,6 +162,15 @@ public function buildForm(array $form, FormStateInterface $form_state) { '#type' => 'container', '#tree' => TRUE, ]; + $form['mail_templates']['watcher'][$entity_type]['subject'] = [ + '#type' => 'textfield', + '#title' => $this->t('Default mail subject for sending out notifications to commenters'), + '#default_value' => $config->get('mail_templates.watcher.' . $entity_type . '.subject'), + '#token_types' => [ + 'comment', 'comment-subscribed', $entity_type, + ], + '#element_validate' => ['token_element_validate'], + ]; $form['mail_templates']['watcher'][$entity_type]['body'] = [ '#type' => 'textarea', '#title' => $this->t('%label: Default mail text for sending out notifications to commenters', [ @@ -189,6 +198,15 @@ public function buildForm(array $form, FormStateInterface $form_state) { '#type' => 'container', '#tree' => TRUE, ]; + $form['mail_templates']['entity_author'][$entity_type]['subject'] = [ + '#type' => 'textfield', + '#title' => $this->t('Default mail subject for sending out notifications to authors'), + '#default_value' => $config->get('mail_templates.entity_author.' . $entity_type . '.subject'), + '#token_types' => [ + 'comment', $entity_type, 'user', + ], + '#element_validate' => ['token_element_validate'], + ]; $form['mail_templates']['entity_author'][$entity_type]['body'] = [ '#type' => 'textarea', '#title' => $this->t('%label: Default mail text for sending out the notifications to entity authors', [ @@ -285,7 +303,9 @@ public function submitForm(array &$form, FormStateInterface $form_state) { foreach ($bundle_checkboxes as $identifier => $label) { $comment_field_info = explode('--', $identifier); $entity_type = $comment_field_info[0]; + $config->set('mail_templates.watcher.' . $entity_type . '.subject', $form_state->getValue(['mail_templates', 'watcher', $entity_type, 'subject'])); $config->set('mail_templates.watcher.' . $entity_type . '.body', $form_state->getValue(['mail_templates', 'watcher', $entity_type, 'body'])); + $config->set('mail_templates.entity_author.' . $entity_type . '.subject', $form_state->getValue(['mail_templates', 'entity_author', $entity_type, 'subject'])); $config->set('mail_templates.entity_author.' . $entity_type . '.body', $form_state->getValue(['mail_templates', 'entity_author', $entity_type, 'body'])); } $config->save();