← All changes
|
includes/templates/class-template-request-for-quote.php
+131
-126
1.6.21
→
1.4.0
View file →
| @@ -1,126 +1,131 @@ | ||
| 1 | -<?php | |
| 2 | - | |
| 3 | -/** | |
| 4 | - * Blank form template | |
| 5 | - */ | |
| 6 | -class WeForms_Template_Request_For_Quote extends WeForms_Form_Template { | |
| 7 | - | |
| 8 | - public function __construct() { | |
| 9 | - parent::__construct(); | |
| 10 | - | |
| 11 | - $this->enabled = class_exists( 'WeForms_Pro' ); | |
| 12 | - $this->title = __( 'Request for Quote', 'weforms' ); | |
| 13 | - $this->description = __( 'This form will make your customers request for quote easier.', 'weforms' ); | |
| 14 | - $this->image = WEFORMS_ASSET_URI . '/images/form-template/qoute_request.png'; | |
| 15 | - $this->category = 'request'; | |
| 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['name_field']->get_field_props(), [ | |
| 28 | - 'required' => 'yes', | |
| 29 | - 'label' => __( 'Name', 'weforms' ), | |
| 30 | - 'format' => 'first-last', | |
| 31 | - 'name' => 'format', | |
| 32 | - ] ), | |
| 33 | - | |
| 34 | - array_merge( $all_fields['numeric_text_field']->get_field_props(), [ | |
| 35 | - 'required' => 'yes', | |
| 36 | - 'label' => __( 'Phone Number', 'weforms' ), | |
| 37 | - 'name' => 'phone_number', | |
| 38 | - ] ), | |
| 39 | - | |
| 40 | - array_merge( $all_fields['email_address']->get_field_props(), [ | |
| 41 | - 'required' => 'yes', | |
| 42 | - 'label' => __( 'Email Address', 'weforms' ), | |
| 43 | - 'name' => 'email_address', | |
| 44 | - ] ), | |
| 45 | - | |
| 46 | - array_merge( $all_fields['radio_field']->get_field_props(), [ | |
| 47 | - 'required' => 'yes', | |
| 48 | - 'label' => __( 'Preferred Method of Contact', 'weforms' ), | |
| 49 | - 'name' => 'preferred_method', | |
| 50 | - 'options' => [ | |
| 51 | - 'prefer_phone' => 'Phone', | |
| 52 | - 'prefer_email' => 'Email', | |
| 53 | - 'prefer_either' => 'Either', | |
| 54 | - ], | |
| 55 | - ] ), | |
| 56 | - | |
| 57 | - array_merge( $all_fields['radio_field']->get_field_props(), [ | |
| 58 | - 'required' => 'yes', | |
| 59 | - 'label' => __( 'Preferred Type of Trip', 'weforms' ), | |
| 60 | - 'name' => 'preferred_trip', | |
| 61 | - 'options' => [ | |
| 62 | - 'one_way' => 'One Way', | |
| 63 | - 'round_trip' => 'Round Trip', | |
| 64 | - 'hourly' => 'Hourly', | |
| 65 | - ], | |
| 66 | - ] ), | |
| 67 | - | |
| 68 | - array_merge( $all_fields['address_field']->get_field_props(), [ | |
| 69 | - 'required' => 'yes', | |
| 70 | - 'label' => __( 'Pickup Address ', 'weforms' ), | |
| 71 | - 'name' => 'pickup_address', | |
| 72 | - ] ), | |
| 73 | - | |
| 74 | - array_merge( $all_fields['dropdown_field']->get_field_props(), [ | |
| 75 | - 'required' => 'yes', | |
| 76 | - 'label' => __( 'Number of Passengers', 'weforms' ), | |
| 77 | - 'name' => 'number_of_passengers', | |
| 78 | - 'options' => [ | |
| 79 | - '1' => '1', | |
| 80 | - '2' => '2', | |
| 81 | - '3' => '3', | |
| 82 | - '4' => '4', | |
| 83 | - '5' => '5', | |
| 84 | - '6' => '6', | |
| 85 | - '7' => '7', | |
| 86 | - '8' => '8', | |
| 87 | - '9' => '9', | |
| 88 | - '10' => '10', | |
| 89 | - '11' => '11', | |
| 90 | - '12' => '12', | |
| 91 | - '13' => '13', | |
| 92 | - '14' => '14', | |
| 93 | - ], | |
| 94 | - ] ), | |
| 95 | - | |
| 96 | - array_merge( $all_fields['dropdown_field']->get_field_props(), [ | |
| 97 | - 'required' => 'yes', | |
| 98 | - 'label' => __( 'Number of Hours ', 'weforms' ), | |
| 99 | - 'name' => 'number_of_hours ', | |
| 100 | - 'options' => [ | |
| 101 | - '1' => '1', | |
| 102 | - '2' => '2', | |
| 103 | - '3' => '3', | |
| 104 | - '4' => '4', | |
| 105 | - '5' => '5', | |
| 106 | - '6' => '6', | |
| 107 | - '7' => '7', | |
| 108 | - '8' => '8', | |
| 109 | - '9' => '9', | |
| 110 | - '10' => '10', | |
| 111 | - '11' => '11', | |
| 112 | - '12' => '12', | |
| 113 | - '13' => '13', | |
| 114 | - '14' => '14', | |
| 115 | - ], | |
| 116 | - ] ), | |
| 117 | - | |
| 118 | - array_merge( $all_fields['textarea_field']->get_field_props(), [ | |
| 119 | - 'label' => __( 'Comments/Special Requests', 'weforms' ), | |
| 120 | - 'name' => 'comments_request', | |
| 121 | - ] ), | |
| 122 | - ]; | |
| 123 | - | |
| 124 | - return $form_fields; | |
| 125 | - } | |
| 126 | -} | |
| 1 | +<?php | |
| 2 | + | |
| 3 | +/** | |
| 4 | + * Blank form template | |
| 5 | + */ | |
| 6 | +class WeForms_Template_Request_For_Quote extends WeForms_Form_Template { | |
| 7 | + | |
| 8 | + public function __construct() { | |
| 9 | + parent::__construct(); | |
| 10 | + | |
| 11 | + $this->enabled = class_exists( 'WeForms_Pro' ); | |
| 12 | + $this->title = __( 'Request for Quote', 'weforms' ); | |
| 13 | + $this->description = __( 'This form will make your customers request for quote easier.', 'weforms' ); | |
| 14 | + $this->image = WEFORMS_ASSET_URI . '/images/form-template/qoute_request.png'; | |
| 15 | + $this->category = 'request'; | |
| 16 | + } | |
| 17 | + | |
| 18 | + /** | |
| 19 | + * Get the form fields | |
| 20 | + * | |
| 21 | + * @return array | |
| 22 | + */ | |
| 23 | + public function get_form_fields() { | |
| 24 | + | |
| 25 | + $all_fields = $this->get_available_fields(); | |
| 26 | + | |
| 27 | + $form_fields = array( | |
| 28 | + | |
| 29 | + array_merge($all_fields['name_field']->get_field_props(), array( | |
| 30 | + 'required' => 'yes', | |
| 31 | + 'label' => __('Name', 'weforms'), | |
| 32 | + 'format' => 'first-last', | |
| 33 | + 'name' => 'format', | |
| 34 | + )), | |
| 35 | + | |
| 36 | + array_merge($all_fields['numeric_text_field']->get_field_props(), array( | |
| 37 | + 'required' => 'yes', | |
| 38 | + 'label' => __('Phone Number', 'weforms'), | |
| 39 | + 'name' => 'phone_number', | |
| 40 | + )), | |
| 41 | + | |
| 42 | + array_merge($all_fields['email_address']->get_field_props(), array( | |
| 43 | + 'required' => 'yes', | |
| 44 | + 'label' => __('Email Address', 'weforms'), | |
| 45 | + 'name' => 'email_address', | |
| 46 | + )), | |
| 47 | + | |
| 48 | + array_merge($all_fields['radio_field']->get_field_props(), array( | |
| 49 | + 'required' => 'yes', | |
| 50 | + 'label' => __('Preferred Method of Contact', 'weforms'), | |
| 51 | + 'name' => 'preferred_method', | |
| 52 | + 'options' => array( | |
| 53 | + 'prefer_phone' => 'Phone', | |
| 54 | + 'prefer_email' => 'Email', | |
| 55 | + 'prefer_either' => 'Either', | |
| 56 | + ), | |
| 57 | + )), | |
| 58 | + | |
| 59 | + | |
| 60 | + array_merge($all_fields['radio_field']->get_field_props(), array( | |
| 61 | + 'required' => 'yes', | |
| 62 | + 'label' => __('Preferred Type of Trip', 'weforms'), | |
| 63 | + 'name' => 'preferred_trip', | |
| 64 | + 'options' => array( | |
| 65 | + 'one_way' => 'One Way', | |
| 66 | + 'round_trip' => 'Round Trip', | |
| 67 | + 'hourly' => 'Hourly', | |
| 68 | + ), | |
| 69 | + )), | |
| 70 | + | |
| 71 | + | |
| 72 | + array_merge($all_fields['address_field']->get_field_props(), array( | |
| 73 | + 'required' => 'yes', | |
| 74 | + 'label' => __('Pickup Address ', 'weforms'), | |
| 75 | + 'name' => 'pickup_address', | |
| 76 | + )), | |
| 77 | + | |
| 78 | + array_merge($all_fields['dropdown_field']->get_field_props(), array( | |
| 79 | + 'required' => 'yes', | |
| 80 | + 'label' => __('Number of Passengers', 'weforms'), | |
| 81 | + 'name' => 'number_of_passengers', | |
| 82 | + 'options' => array( | |
| 83 | + '1' => '1', | |
| 84 | + '2' => '2', | |
| 85 | + '3' => '3', | |
| 86 | + '4' => '4', | |
| 87 | + '5' => '5', | |
| 88 | + '6' => '6', | |
| 89 | + '7' => '7', | |
| 90 | + '8' => '8', | |
| 91 | + '9' => '9', | |
| 92 | + '10' => '10', | |
| 93 | + '11' => '11', | |
| 94 | + '12' => '12', | |
| 95 | + '13' => '13', | |
| 96 | + '14' => '14', | |
| 97 | + ), | |
| 98 | + )), | |
| 99 | + | |
| 100 | + array_merge($all_fields['dropdown_field']->get_field_props(), array( | |
| 101 | + 'required' => 'yes', | |
| 102 | + 'label' => __('Number of Hours ', 'weforms'), | |
| 103 | + 'name' => 'number_of_hours ', | |
| 104 | + 'options' => array( | |
| 105 | + '1' => '1', | |
| 106 | + '2' => '2', | |
| 107 | + '3' => '3', | |
| 108 | + '4' => '4', | |
| 109 | + '5' => '5', | |
| 110 | + '6' => '6', | |
| 111 | + '7' => '7', | |
| 112 | + '8' => '8', | |
| 113 | + '9' => '9', | |
| 114 | + '10' => '10', | |
| 115 | + '11' => '11', | |
| 116 | + '12' => '12', | |
| 117 | + '13' => '13', | |
| 118 | + '14' => '14', | |
| 119 | + ), | |
| 120 | + )), | |
| 121 | + | |
| 122 | + array_merge($all_fields['textarea_field']->get_field_props(), array( | |
| 123 | + 'label' => __('Comments/Special Requests', 'weforms'), | |
| 124 | + 'name' => 'comments_request' | |
| 125 | + )), | |
| 126 | + ); | |
| 127 | + | |
| 128 | + return $form_fields; | |
| 129 | + } | |
| 130 | + | |
| 131 | +} | |