← All changes
|
includes/templates/class-template-bug-report.php
+192
-186
1.6.21
→
1.4.0
View file →
| @@ -1,186 +1,192 @@ | ||
| 1 | -<?php | |
| 2 | - | |
| 3 | -/** | |
| 4 | - * Blank form template | |
| 5 | - */ | |
| 6 | -class WeForms_Template_Bug_Report extends WeForms_Form_Template { | |
| 7 | - | |
| 8 | - public function __construct() { | |
| 9 | - parent::__construct(); | |
| 10 | - | |
| 11 | - $this->enabled = true; | |
| 12 | - $this->title = __( 'Report a bug', 'weforms' ); | |
| 13 | - $this->description = __( 'Here\'s a great way to make a form for use with reporting issues, feedback, suggestions, and questions or bugtracking', 'weforms' ); | |
| 14 | - $this->image = WEFORMS_ASSET_URI . '/images/form-template/bug_report.png'; | |
| 15 | - $this->category = 'feedback'; | |
| 16 | - } | |
| 17 | - | |
| 18 | - /** | |
| 19 | - * Get the form fields | |
| 20 | - * | |
| 21 | - * @return array | |
| 22 | - */ | |
| 23 | - public function get_form_fields() { | |
| 24 | - $all_fields = $this->get_available_fields(); | |
| 25 | - | |
| 26 | - $form_fields = [ | |
| 27 | - array_merge( $all_fields['section_break']->get_field_props(), [ | |
| 28 | - 'label' => __( 'Report a bug', 'weforms' ), | |
| 29 | - 'description' => ' ', | |
| 30 | - ] ), | |
| 31 | - | |
| 32 | - array_merge( $all_fields['step_start']->get_field_props(), [ | |
| 33 | - 'label' => __( 'First Step', 'weforms' ), | |
| 34 | - 'name' => 'report_bug_step', | |
| 35 | - 'step_start' => [ | |
| 36 | - 'prev_button_text' => __( 'Previous', 'weforms' ), | |
| 37 | - 'next_button_text' => __( 'Next', 'weforms' ), | |
| 38 | - ], | |
| 39 | - ] ), | |
| 40 | - | |
| 41 | - array_merge( $all_fields['text_field']->get_field_props(), [ | |
| 42 | - 'required' => 'yes', | |
| 43 | - 'label' => __( 'Full Name', 'weforms' ), | |
| 44 | - 'name' => 'full_name', | |
| 45 | - ] ), | |
| 46 | - | |
| 47 | - array_merge( $all_fields['email_address']->get_field_props(), [ | |
| 48 | - 'required' => 'yes', | |
| 49 | - 'label' => __( 'Email Address', 'weforms' ), | |
| 50 | - 'name' => 'email_address', | |
| 51 | - ] ), | |
| 52 | - | |
| 53 | - array_merge( $all_fields['text_field']->get_field_props(), [ | |
| 54 | - 'required' => 'yes', | |
| 55 | - 'label' => __( 'Problem Title', 'weforms' ), | |
| 56 | - 'name' => 'email_address', | |
| 57 | - ] ), | |
| 58 | - | |
| 59 | - array_merge( $all_fields['dropdown_field']->get_field_props(), [ | |
| 60 | - 'label' => __( 'Problem Status', 'weforms' ), | |
| 61 | - 'name' => 'problem_status', | |
| 62 | - 'options' => [ | |
| 63 | - 'open' => __( 'Open', 'weforms' ), | |
| 64 | - 'fixed' => __( 'Fixed', 'weforms' ), | |
| 65 | - 'verified' => __( 'Veried', 'weforms' ), | |
| 66 | - 'closed' => __( 'Closed', 'weforms' ), | |
| 67 | - 'invalid' => __( 'Invalid', 'weforms' ), | |
| 68 | - ], | |
| 69 | - 'first' => ' ', | |
| 70 | - ] ), | |
| 71 | - | |
| 72 | - array_merge( $all_fields['textarea_field']->get_field_props(), [ | |
| 73 | - 'required' => 'yes', | |
| 74 | - 'label' => __( 'Summary Information', 'weforms' ), | |
| 75 | - 'name' => 'summary_information', | |
| 76 | - ] ), | |
| 77 | - | |
| 78 | - array_merge( $all_fields['step_start']->get_field_props(), [ | |
| 79 | - 'label' => __( 'Second Step', 'weforms' ), | |
| 80 | - 'name' => 'report_bug_step_two', | |
| 81 | - 'step_start' => [ | |
| 82 | - 'prev_button_text' => __( 'Previous', 'weforms' ), | |
| 83 | - 'next_button_text' => __( 'Next', 'weforms' ), | |
| 84 | - ], | |
| 85 | - ] ), | |
| 86 | - | |
| 87 | - array_merge( $all_fields['textarea_field']->get_field_props(), [ | |
| 88 | - 'required' => 'yes', | |
| 89 | - 'label' => __( 'Steps to Reproduce', 'weforms' ), | |
| 90 | - 'name' => 'report_bug_two', | |
| 91 | - 'help_text' => __( 'Include any setup or preparation work and the steps we can take to reproduce the problem', 'weforms' ), | |
| 92 | - ] ), | |
| 93 | - | |
| 94 | - array_merge( $all_fields['textarea_field']->get_field_props(), [ | |
| 95 | - 'required' => 'yes', | |
| 96 | - 'label' => __( 'Results', 'weforms' ), | |
| 97 | - 'name' => 'result', | |
| 98 | - 'help_text' => __( 'Describe your results and how they differed from what you expected.', 'weforms' ), | |
| 99 | - ] ), | |
| 100 | - | |
| 101 | - array_merge( $all_fields['textarea_field']->get_field_props(), [ | |
| 102 | - 'label' => __( 'Regression', 'weforms' ), | |
| 103 | - 'name' => 'regression', | |
| 104 | - 'help_text' => __( 'Provide information on steps taken to isolate the problem. Under what conditions or circumstances does the problem occur or not occur.', 'weforms' ), | |
| 105 | - ] ), | |
| 106 | - | |
| 107 | - array_merge( $all_fields['checkbox_field']->get_field_props(), [ | |
| 108 | - 'label' => __( 'Is there a Workaround?', 'weforms' ), | |
| 109 | - 'name' => 'workaround', | |
| 110 | - 'options' => [ | |
| 111 | - 'yes' => __( 'yes', 'weforms' ), | |
| 112 | - 'no' => __( 'No', 'weforms' ), | |
| 113 | - ], | |
| 114 | - ] ), | |
| 115 | - | |
| 116 | - array_merge( $all_fields['textarea_field']->get_field_props(), [ | |
| 117 | - 'label' => __( 'Documentation & Notes', 'weforms' ), | |
| 118 | - 'name' => 'documentation_notes', | |
| 119 | - 'help_text' => __( 'Document any additional information that might be useful in resolving the problem.', 'weforms' ), | |
| 120 | - ] ), | |
| 121 | - | |
| 122 | - array_merge( $all_fields['dropdown_field']->get_field_props(), [ | |
| 123 | - 'required' => 'yes', | |
| 124 | - 'label' => __( 'Reproducibility', 'weforms' ), | |
| 125 | - 'name' => 'reproducibility', | |
| 126 | - 'options' => [ | |
| 127 | - 'try' => __( 'I didn\'t try', 'weforms' ), | |
| 128 | - 'rare' => __( 'Rarely', 'weforms' ), | |
| 129 | - 'sometimes' => __( 'Sometimes', 'weforms' ), | |
| 130 | - 'always' => __( 'Always', 'weforms' ), | |
| 131 | - ], | |
| 132 | - | |
| 133 | - 'first' => ' ', | |
| 134 | - ] ), | |
| 135 | - | |
| 136 | - array_merge( $all_fields['dropdown_field']->get_field_props(), [ | |
| 137 | - 'required' => 'yes', | |
| 138 | - 'label' => __( 'Classification', 'weforms' ), | |
| 139 | - 'name' => 'classification', | |
| 140 | - 'options' => [ | |
| 141 | - 'security' => __( 'Security', 'weforms' ), | |
| 142 | - 'crash' => __( 'Crash/Hang/Data loss', 'weforms' ), | |
| 143 | - 'performance' => __( 'Performance/UI-Usability', 'weforms' ), | |
| 144 | - 'serious_bug' => __( 'Serious Bug', 'weforms' ), | |
| 145 | - 'other_bug' => __( 'Other Bug', 'weforms' ), | |
| 146 | - 'feature' => __( 'Feature (New)', 'weforms' ), | |
| 147 | - 'enhancement' => __( 'Enhancement', 'weforms' ), | |
| 148 | - ], | |
| 149 | - | |
| 150 | - 'first' => ' ', | |
| 151 | - ] ), | |
| 152 | - | |
| 153 | - array_merge( $all_fields['dropdown_field']->get_field_props(), [ | |
| 154 | - 'required' => 'yes', | |
| 155 | - 'label' => __( 'Severity', 'weforms' ), | |
| 156 | - 'name' => 'severity', | |
| 157 | - 'options' => [ | |
| 158 | - 'trivial' => __( 'Trivial', 'weforms' ), | |
| 159 | - 'normal' => __( 'Normal', 'weforms' ), | |
| 160 | - 'major' => __( 'Major', 'weforms' ), | |
| 161 | - 'critical' => __( 'Critical', 'weforms' ), | |
| 162 | - ], | |
| 163 | - | |
| 164 | - 'first' => ' ', | |
| 165 | - ] ), | |
| 166 | - ]; | |
| 167 | - | |
| 168 | - return $form_fields; | |
| 169 | - } | |
| 170 | - | |
| 171 | - /** | |
| 172 | - * Get the form settings | |
| 173 | - * | |
| 174 | - * @return array | |
| 175 | - */ | |
| 176 | - public function get_form_settings() { | |
| 177 | - $defaults = $this->get_default_settings(); | |
| 178 | - | |
| 179 | - return array_merge( $defaults, [ | |
| 180 | - 'submit_text' => __( 'Submit', 'weforms' ), | |
| 181 | - 'label_position' => 'above', | |
| 182 | - 'enable_multistep' => true, | |
| 183 | - 'multistep_progressbar_type' => 'step_by_step', | |
| 184 | - ] ); | |
| 185 | - } | |
| 186 | -} | |
| 1 | +<?php | |
| 2 | + | |
| 3 | +/** | |
| 4 | + * Blank form template | |
| 5 | + */ | |
| 6 | +class WeForms_Template_Bug_Report extends WeForms_Form_Template { | |
| 7 | + | |
| 8 | + public function __construct() { | |
| 9 | + parent::__construct(); | |
| 10 | + | |
| 11 | + $this->enabled = true; | |
| 12 | + $this->title = __( 'Report a bug', 'weforms' ); | |
| 13 | + $this->description = __( 'Here\'s a great way to make a form for use with reporting issues, feedback, suggestions, and questions or bugtracking', 'weforms' ); | |
| 14 | + $this->image = WEFORMS_ASSET_URI . '/images/form-template/bug_report.png'; | |
| 15 | + $this->category = 'feedback'; | |
| 16 | + | |
| 17 | + } | |
| 18 | + | |
| 19 | + /** | |
| 20 | + * Get the form fields | |
| 21 | + * | |
| 22 | + * @return array | |
| 23 | + */ | |
| 24 | + public function get_form_fields() { | |
| 25 | + $all_fields = $this->get_available_fields(); | |
| 26 | + | |
| 27 | + $form_fields = array( | |
| 28 | + array_merge( $all_fields['section_break']->get_field_props(), array( | |
| 29 | + 'label' => __( 'Report a bug', 'weforms' ), | |
| 30 | + 'description' => ' ', | |
| 31 | + ) ), | |
| 32 | + | |
| 33 | + array_merge( $all_fields['step_start']->get_field_props(), array( | |
| 34 | + 'label' => __( 'First Step', 'weforms' ), | |
| 35 | + 'name' => 'report_bug_step', | |
| 36 | + 'step_start' => array( | |
| 37 | + 'prev_button_text' => __( 'Previous', 'weforms' ), | |
| 38 | + 'next_button_text' => __( 'Next', 'weforms' ) | |
| 39 | + ), | |
| 40 | + ) ), | |
| 41 | + | |
| 42 | + array_merge( $all_fields['text_field']->get_field_props(), array( | |
| 43 | + 'required' => 'yes', | |
| 44 | + 'label' => __( 'Full Name', 'weforms' ), | |
| 45 | + 'name' => 'full_name', | |
| 46 | + ) ), | |
| 47 | + | |
| 48 | + array_merge( $all_fields['email_address']->get_field_props(), array( | |
| 49 | + 'required' => 'yes', | |
| 50 | + 'label' => __( 'Email Address', 'weforms' ), | |
| 51 | + 'name' => 'email_address', | |
| 52 | + ) ), | |
| 53 | + | |
| 54 | + array_merge( $all_fields['text_field']->get_field_props(), array( | |
| 55 | + 'required' => 'yes', | |
| 56 | + 'label' => __( 'Problem Title', 'weforms' ), | |
| 57 | + 'name' => 'email_address', | |
| 58 | + ) ), | |
| 59 | + | |
| 60 | + array_merge( $all_fields['dropdown_field']->get_field_props(), array( | |
| 61 | + 'label' => __( 'Problem Status', 'weforms' ), | |
| 62 | + 'name' => 'problem_status', | |
| 63 | + 'options' => array( | |
| 64 | + 'open' => __('Open', 'weforms'), | |
| 65 | + 'fixed' => __('Fixed', 'weforms'), | |
| 66 | + 'verified' => __('Veried', 'weforms'), | |
| 67 | + 'closed' => __('Closed', 'weforms'), | |
| 68 | + 'invalid' => __('Invalid', 'weforms'), | |
| 69 | + ), | |
| 70 | + 'first' => ' ', | |
| 71 | + ) ), | |
| 72 | + | |
| 73 | + array_merge( $all_fields['textarea_field']->get_field_props(), array( | |
| 74 | + 'required' => 'yes', | |
| 75 | + 'label' => __( 'Summary Information', 'weforms' ), | |
| 76 | + 'name' => 'summary_information', | |
| 77 | + ) ), | |
| 78 | + | |
| 79 | + array_merge( $all_fields['step_start']->get_field_props(), array( | |
| 80 | + 'label' => __( 'Second Step', 'weforms' ), | |
| 81 | + 'name' => 'report_bug_step_two', | |
| 82 | + 'step_start' => array( | |
| 83 | + 'prev_button_text' => __( 'Previous', 'weforms' ), | |
| 84 | + 'next_button_text' => __( 'Next', 'weforms' ) | |
| 85 | + ), | |
| 86 | + ) ), | |
| 87 | + | |
| 88 | + array_merge( $all_fields['textarea_field']->get_field_props(), array( | |
| 89 | + 'required' => 'yes', | |
| 90 | + 'label' => __( 'Steps to Reproduce', 'weforms' ), | |
| 91 | + 'name' => 'report_bug_two', | |
| 92 | + 'help_text' => __( 'Include any setup or preparation work and the steps we can take to reproduce the problem', 'weforms' ), | |
| 93 | + ) ), | |
| 94 | + | |
| 95 | + array_merge( $all_fields['textarea_field']->get_field_props(), array( | |
| 96 | + 'required' => 'yes', | |
| 97 | + 'label' => __( 'Results', 'weforms' ), | |
| 98 | + 'name' => 'result', | |
| 99 | + 'help_text' => __( 'Describe your results and how they differed from what you expected.', 'weforms' ), | |
| 100 | + ) ), | |
| 101 | + | |
| 102 | + array_merge( $all_fields['textarea_field']->get_field_props(), array( | |
| 103 | + 'label' => __( 'Regression', 'weforms' ), | |
| 104 | + 'name' => 'regression', | |
| 105 | + 'help_text' => __( 'Provide information on steps taken to isolate the problem. Under what conditions or circumstances does the problem occur or not occur.', 'weforms' ), | |
| 106 | + ) ), | |
| 107 | + | |
| 108 | + array_merge( $all_fields['checkbox_field']->get_field_props(), array( | |
| 109 | + 'label' => __( 'Is there a Workaround?', 'weforms' ), | |
| 110 | + 'name' => 'workaround', | |
| 111 | + 'options' => array( | |
| 112 | + 'yes' => __('yes', 'weforms'), | |
| 113 | + 'no' => __('No', 'weforms'), | |
| 114 | + ), | |
| 115 | + ) ), | |
| 116 | + | |
| 117 | + array_merge( $all_fields['textarea_field']->get_field_props(), array( | |
| 118 | + 'label' => __( 'Documentation & Notes', 'weforms' ), | |
| 119 | + 'name' => 'documentation_notes', | |
| 120 | + 'help_text' => __( 'Document any additional information that might be useful in resolving the problem.', 'weforms' ), | |
| 121 | + ) ), | |
| 122 | + | |
| 123 | + array_merge( $all_fields['dropdown_field']->get_field_props(), array( | |
| 124 | + 'required' => 'yes', | |
| 125 | + 'label' => __( 'Reproducibility', 'weforms' ), | |
| 126 | + 'name' => 'reproducibility', | |
| 127 | + 'options' => array( | |
| 128 | + 'try' => __('I didn\'t try', 'weforms'), | |
| 129 | + 'rare' => __('Rarely', 'weforms'), | |
| 130 | + 'sometimes' => __('Sometimes', 'weforms'), | |
| 131 | + 'always' => __('Always', 'weforms'), | |
| 132 | + ), | |
| 133 | + | |
| 134 | + 'first' => ' ', | |
| 135 | + | |
| 136 | + ) ), | |
| 137 | + | |
| 138 | + array_merge( $all_fields['dropdown_field']->get_field_props(), array( | |
| 139 | + 'required' => 'yes', | |
| 140 | + 'label' => __( 'Classification', 'weforms' ), | |
| 141 | + 'name' => 'classification', | |
| 142 | + 'options' => array( | |
| 143 | + 'security' => __('Security', 'weforms'), | |
| 144 | + 'crash' => __('Crash/Hang/Data loss', 'weforms'), | |
| 145 | + 'performance' => __('Performance/UI-Usability', 'weforms'), | |
| 146 | + 'serious_bug' => __('Serious Bug', 'weforms'), | |
| 147 | + 'other_bug' => __('Other Bug', 'weforms'), | |
| 148 | + 'feature' => __('Feature (New)', 'weforms'), | |
| 149 | + 'enhancement' => __('Enhancement', 'weforms'), | |
| 150 | + ), | |
| 151 | + | |
| 152 | + 'first' => ' ', | |
| 153 | + | |
| 154 | + ) ), | |
| 155 | + | |
| 156 | + array_merge( $all_fields['dropdown_field']->get_field_props(), array( | |
| 157 | + 'required' => 'yes', | |
| 158 | + 'label' => __( 'Severity', 'weforms' ), | |
| 159 | + 'name' => 'severity', | |
| 160 | + 'options' => array( | |
| 161 | + 'trivial' => __('Trivial', 'weforms'), | |
| 162 | + 'normal' => __('Normal', 'weforms'), | |
| 163 | + 'major' => __('Major', 'weforms'), | |
| 164 | + 'critical' => __('Critical', 'weforms'), | |
| 165 | + ), | |
| 166 | + | |
| 167 | + 'first' => ' ', | |
| 168 | + | |
| 169 | + ) ), | |
| 170 | + ); | |
| 171 | + | |
| 172 | + return $form_fields; | |
| 173 | + } | |
| 174 | + | |
| 175 | + | |
| 176 | + /** | |
| 177 | + * Get the form settings | |
| 178 | + * | |
| 179 | + * @return array | |
| 180 | + */ | |
| 181 | + public function get_form_settings() { | |
| 182 | + $defaults = $this->get_default_settings(); | |
| 183 | + | |
| 184 | + return array_merge( $defaults, array( | |
| 185 | + 'submit_text' => __( 'Submit', 'weforms' ), | |
| 186 | + 'label_position' => 'above', | |
| 187 | + 'enable_multistep' => true, | |
| 188 | + 'multistep_progressbar_type' => 'step_by_step', | |
| 189 | + ) ); | |
| 190 | + } | |
| 191 | + | |
| 192 | +} | |