| 1 |
<?php |
| 2 |
namespace RadiusTheme\SB\Modules\CheckoutEditor; |
| 3 |
|
| 4 |
// Do not allow directly accessing this file. |
| 5 |
if ( ! defined( 'ABSPATH' ) ) { |
| 6 |
exit( 'This script cannot be accessed directly.' ); |
| 7 |
} |
| 8 |
/** |
| 9 |
* CheckoutEditorInit |
| 10 |
*/ |
| 11 |
class CheckoutFns { |
| 12 |
/** |
| 13 |
* Checkout Billing Field. |
| 14 |
* |
| 15 |
* @return array[] |
| 16 |
*/ |
| 17 |
public static function default_billing_fields() { |
| 18 |
return [ |
| 19 |
[ |
| 20 |
'id' => 1, |
| 21 |
'deletable' => 'no', |
| 22 |
'isEnable' => 'on', |
| 23 |
'label' => esc_html__( 'First Name', 'shopbuilder' ), |
| 24 |
'type' => 'text', |
| 25 |
'options' => [], |
| 26 |
'name' => 'first_name', |
| 27 |
'validation' => 'default', |
| 28 |
'placeholder' => esc_html__( 'Enter your first name.', 'shopbuilder' ), |
| 29 |
'isRequired' => 'on', |
| 30 |
'default' => '', |
| 31 |
'custom_class' => 'form-row-first', |
| 32 |
], |
| 33 |
[ |
| 34 |
'id' => 2, |
| 35 |
'deletable' => 'no', |
| 36 |
'isEnable' => 'on', |
| 37 |
'label' => esc_html__( 'Last Name', 'shopbuilder' ), |
| 38 |
'type' => 'text', |
| 39 |
'options' => [], |
| 40 |
'name' => 'last_name', |
| 41 |
'isRequired' => 'on', |
| 42 |
'placeholder' => esc_html__( 'Last Name', 'shopbuilder' ), |
| 43 |
'default' => '', |
| 44 |
'validation' => 'default', |
| 45 |
'custom_class' => 'form-row-last', |
| 46 |
], |
| 47 |
[ |
| 48 |
'id' => 3, |
| 49 |
'deletable' => 'no', |
| 50 |
'label' => esc_html__( 'Company Name', 'shopbuilder' ), |
| 51 |
'placeholder' => '', |
| 52 |
'type' => 'text', |
| 53 |
'options' => [], |
| 54 |
'isEnable' => 'on', |
| 55 |
'name' => 'company', |
| 56 |
'custom_class' => 'form-row-wide', |
| 57 |
], |
| 58 |
[ |
| 59 |
'id' => 4, |
| 60 |
'deletable' => 'no', |
| 61 |
'label' => esc_html__( 'Country', 'shopbuilder' ), |
| 62 |
'name' => 'country', |
| 63 |
'placeholder' => '', |
| 64 |
'type' => 'text', |
| 65 |
'options' => [], |
| 66 |
'isEnable' => 'on', |
| 67 |
'custom_class' => 'form-row-wide,address-field,update_totals_on_change', |
| 68 |
], |
| 69 |
[ |
| 70 |
'id' => 5, |
| 71 |
'deletable' => 'no', |
| 72 |
'label' => esc_html__( 'Street address', 'shopbuilder' ), |
| 73 |
'type' => 'text', |
| 74 |
'placeholder' => esc_html__( 'House number and street name', 'shopbuilder' ), |
| 75 |
'options' => [], |
| 76 |
'name' => 'address_1', |
| 77 |
'custom_class' => 'form-row-wide,address-field', |
| 78 |
'validation' => 'state', |
| 79 |
'isEnable' => 'on', |
| 80 |
], |
| 81 |
[ |
| 82 |
'id' => 6, |
| 83 |
'deletable' => 'no', |
| 84 |
'label' => esc_html__( 'Apartment Address', 'shopbuilder' ), |
| 85 |
'placeholder' => esc_html__( 'Apartment, suite, unit, etc. (optional)', 'shopbuilder' ), |
| 86 |
'custom_class' => 'form-row-wide,address-field', |
| 87 |
'type' => 'text', |
| 88 |
'options' => [], |
| 89 |
'isEnable' => 'on', |
| 90 |
'name' => 'address_2', |
| 91 |
], |
| 92 |
[ |
| 93 |
'id' => 7, |
| 94 |
'deletable' => 'no', |
| 95 |
'label' => esc_html__( 'City / Town', 'shopbuilder' ), |
| 96 |
'type' => 'text', |
| 97 |
'placeholder' => '', |
| 98 |
'options' => [], |
| 99 |
'isEnable' => 'on', |
| 100 |
'name' => 'city', |
| 101 |
'validation' => 'default', |
| 102 |
'isRequired' => 'on', |
| 103 |
'custom_class' => 'form-row-wide,address-field', |
| 104 |
], |
| 105 |
[ |
| 106 |
'id' => 8, |
| 107 |
'isEnable' => 'on', |
| 108 |
'deletable' => 'no', |
| 109 |
'label' => esc_html__( 'State/Country', 'shopbuilder' ), |
| 110 |
'type' => 'text', |
| 111 |
'placeholder' => '', |
| 112 |
'options' => [], |
| 113 |
'name' => 'state', |
| 114 |
'validation' => 'state', |
| 115 |
'custom_class' => 'form-row-wide,address-field', |
| 116 |
], |
| 117 |
[ |
| 118 |
'id' => 9, |
| 119 |
'deletable' => 'no', |
| 120 |
'label' => esc_html__( 'Postcode / ZIP', 'shopbuilder' ), |
| 121 |
'type' => 'text', |
| 122 |
'placeholder' => '', |
| 123 |
'options' => [], |
| 124 |
'isEnable' => 'on', |
| 125 |
'name' => 'postcode', |
| 126 |
'validation' => 'postcode', |
| 127 |
'isRequired' => 'on', |
| 128 |
'custom_class' => 'form-row-wide,address-field', |
| 129 |
], |
| 130 |
[ |
| 131 |
'id' => 10, |
| 132 |
'deletable' => 'no', |
| 133 |
'label' => esc_html__( 'Phone', 'shopbuilder' ), |
| 134 |
'placeholder' => '', |
| 135 |
'type' => 'text', |
| 136 |
'options' => [], |
| 137 |
'isEnable' => 'on', |
| 138 |
'name' => 'phone', |
| 139 |
'validation' => 'phone', |
| 140 |
'isRequired' => 'on', |
| 141 |
'custom_class' => 'form-row-wide', |
| 142 |
], |
| 143 |
[ |
| 144 |
'id' => 11, |
| 145 |
'deletable' => 'no', |
| 146 |
'label' => esc_html__( 'Email Address', 'shopbuilder' ), |
| 147 |
'placeholder' => '', |
| 148 |
'type' => 'text', |
| 149 |
'options' => [], |
| 150 |
'isEnable' => 'on', |
| 151 |
'name' => 'email', |
| 152 |
'validation' => 'email', |
| 153 |
'isRequired' => 'on', |
| 154 |
'custom_class' => 'form-row-wide', |
| 155 |
], |
| 156 |
]; |
| 157 |
} |
| 158 |
|
| 159 |
/** |
| 160 |
* Checkout Shipping Field. |
| 161 |
* |
| 162 |
* @return array[] |
| 163 |
*/ |
| 164 |
public static function default_shipping_fields() { |
| 165 |
$fields = self::default_billing_fields(); |
| 166 |
array_splice( $fields, -2 ); |
| 167 |
return $fields; |
| 168 |
} |
| 169 |
|
| 170 |
/** |
| 171 |
* Checkout Additional Field. |
| 172 |
* |
| 173 |
* @return array[] |
| 174 |
*/ |
| 175 |
public static function checkout_additional_fields() { |
| 176 |
return [ |
| 177 |
[ |
| 178 |
'id' => 1, |
| 179 |
'deletable' => 'no', |
| 180 |
'isEnable' => 'on', |
| 181 |
'label' => esc_html__( 'Order Note', 'shopbuilder' ), |
| 182 |
'type' => 'textarea', |
| 183 |
'options' => [], |
| 184 |
'name' => 'comments', |
| 185 |
'validation' => 'default', |
| 186 |
'placeholder' => '', |
| 187 |
'isRequired' => '', |
| 188 |
'default' => '', |
| 189 |
'custom_class' => '', |
| 190 |
], |
| 191 |
]; |
| 192 |
} |
| 193 |
} |
| 194 |
|