| 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 |
} |
| 187 |
|