From 373232b65d50eadc5510eac0bdf8be1b2bc30e6d Mon Sep 17 00:00:00 2001
From: Ben Hall <aydustr@gmail.com>
Date: Tue, 24 Nov 2015 11:07:54 -0700
Subject: [PATCH] Issue 2432295 by specky_rum,GuilleW: Adds option to specify
 alternative wording in feedback message fields.

---
 feedback.admin.inc | 39 +++++++++++++++++++++++++++++++++++++++
 feedback.module    | 12 ++++++++----
 2 files changed, 47 insertions(+), 4 deletions(-)

diff --git a/feedback.admin.inc b/feedback.admin.inc
index 55d7ba1..957c069 100644
--- a/feedback.admin.inc
+++ b/feedback.admin.inc
@@ -260,6 +260,45 @@ function feedback_admin_settings_form($form, &$form_state) {
     '#default_value' => variable_get('feedback_excluded_paths', 'admin/reports/feedback'),
     '#description' => t("Specify pages by using their paths. Enter one path per line. The '*' character is a wildcard. Example paths are %blog for the blog page and %blog-wildcard for every personal blog. %front is the front page.", array('%blog' => 'blog', '%blog-wildcard' => 'blog/*', '%front' => '<front>')),
   );
+  $form['fieldset_labels'] = array(
+    '#type'        => 'fieldset',
+    '#title'       => t('Feedback labels'),
+    '#description' => t('You can edit labels and titles for default fields.'),
+    '#collapsible' => TRUE,
+    '#collapsed' => TRUE,
+  );
+  $form['fieldset_labels']['feedback_title'] = array(
+    '#type' => 'textfield',
+    '#title' => t('Title'),
+    '#size' => 40,
+    '#maxlength' => 128,
+    '#default_value' => variable_get('feedback_title', 'Feedback'),
+    '#description' => t("Specify the title that will appear on the feedback form. Defaults to 'Feedback'"),
+  );
+  $form['fieldset_labels']['feedback_help'] = array(
+    '#type' => 'textfield',
+    '#title' => t('Help'),
+    '#size' => 40,
+    '#maxlength' => 255,
+    '#default_value' => variable_get('feedback_help', 'If you experience a bug or would like to see an addition on the current page, feel free to leave us a message.'),
+    '#description' => t("Feedback submission guidelines. Defaults to 'If you experience a bug or would like to see an addition on the current page, feel free to leave us a message.'"),
+  );
+  $form['fieldset_labels']['feedback_message'] = array(
+    '#type' => 'textfield',
+    '#title' => t('Message'),
+    '#size' => 40,
+    '#maxlength' => 128,
+    '#default_value' => variable_get('feedback_message', 'Message'),
+    '#description' => t("Specify the label that will appear over the feedback message text field. Defaults to 'Message'"),
+  );
+  $form['fieldset_labels']['feedback_submit'] = array(
+    '#type' => 'textfield',
+    '#title' => t('Submit button'),
+    '#size' => 40,
+    '#maxlength' => 128,
+    '#default_value' => variable_get('feedback_submit', 'Send feedback'),
+    '#description' => t("Specify the label that will appear on the feedback submit button. Defaults to 'Send feedback'"),
+  );
   return system_settings_form($form);
 }
 
diff --git a/feedback.module b/feedback.module
index 1921af9..c9a8dfb 100644
--- a/feedback.module
+++ b/feedback.module
@@ -289,9 +289,10 @@ function feedback_menu() {
  */
 function feedback_page_build(&$page) {
   if (user_access('access feedback form') && !feedback_match_path(variable_get('feedback_excluded_paths', 'admin/reports/feedback'))) {
+    $title = variable_get('feedback_title', 'Feedback');
     $page['page_bottom']['feedback'] = array(
       '#theme' => 'feedback_form_display',
-      '#title' => t('Feedback'),
+      '#title' => t($title),
       '#content' => drupal_get_form('feedback_form'),
     );
     $path = drupal_get_path('module', 'feedback');
@@ -344,9 +345,10 @@ function feedback_form($form, &$form_state) {
     '#value' => $form_state['inline']['location'],
   );
 
+  $help = variable_get('feedback_help', 'If you experience a bug or would like to see an addition on the current page, feel free to leave us a message.');
   $form['help'] = array(
     '#prefix' => '<div class="feedback-help">',
-    '#markup' => t('If you experience a bug or would like to see an addition on the current page, feel free to leave us a message.'),
+    '#markup' => t($help),
     '#suffix' => '</div>',
   );
   if (user_access('view feedback messages')) {
@@ -384,11 +386,12 @@ function feedback_form($form, &$form_state) {
       }
     }
   }
+  $message = variable_get('feedback_message', 'Message');
   $form['message'] = array(
     '#type' => 'textarea',
     '#attributes' => array('class' => array('feedback-message')),
     '#cols' => 20,
-    '#title' => t('Message'),
+    '#title' => t($message),
     '#required' => TRUE,
     '#wysiwyg' => FALSE,
   );
@@ -402,9 +405,10 @@ function feedback_form($form, &$form_state) {
     // @todo Patch #type actions in core?
     '#attributes' => array('class' => array('clearfix')),
   );
+  $submit = variable_get('feedback_submit', 'Send feedback');
   $form['actions']['submit'] = array(
     '#type' => 'submit',
-    '#value' => t('Send feedback'),
+    '#value' => t($submit),
     '#id' => 'feedback-submit',
     '#ajax' => array(
       'wrapper' => 'feedback-form',
-- 
GitLab