screens
2 years ago
checkout-form-billing-config.php
4 years ago
checkout-form-billing.php
3 years ago
checkout-form-billing.php
857 lines
| 1 | <?php |
| 2 | |
| 3 | namespace Elementor; |
| 4 | |
| 5 | use ShopEngine\Utils\Helper; |
| 6 | use ShopEngine\Widgets\Products; |
| 7 | |
| 8 | defined('ABSPATH') || exit; |
| 9 | |
| 10 | |
| 11 | class ShopEngine_Checkout_Form_Billing extends \ShopEngine\Base\Widget |
| 12 | { |
| 13 | |
| 14 | public function config() { |
| 15 | return new ShopEngine_Checkout_Form_Billing_Config(); |
| 16 | } |
| 17 | |
| 18 | |
| 19 | protected function register_controls() { |
| 20 | |
| 21 | $this->start_controls_section( |
| 22 | 'shopengine_section_layout', |
| 23 | [ |
| 24 | 'label' => esc_html__('Layout', 'shopengine'), |
| 25 | 'tab' => Controls_Manager::TAB_CONTENT, |
| 26 | ] |
| 27 | ); |
| 28 | |
| 29 | $repeater = new Repeater(); |
| 30 | $this->add_control( |
| 31 | 'shopengine_billing_inputs', |
| 32 | [ |
| 33 | 'label' => esc_html__('Input List', 'shopengine'), |
| 34 | 'type' => Controls_Manager::REPEATER, |
| 35 | 'fields' => $repeater->get_controls(), |
| 36 | 'default' => Helper::get_checkout_input_fields(), |
| 37 | 'title_field' => '{{{ list_title }}}', |
| 38 | 'item_actions' => [ |
| 39 | 'add' => false, |
| 40 | 'duplicate' => false, |
| 41 | 'remove' => false, |
| 42 | 'sort' => true, |
| 43 | ] |
| 44 | ] |
| 45 | ); |
| 46 | |
| 47 | $this->end_controls_section(); |
| 48 | |
| 49 | /** |
| 50 | * Billing form title content |
| 51 | */ |
| 52 | $this->start_controls_section( |
| 53 | 'shopengine_title_content_section', |
| 54 | [ |
| 55 | 'label' => esc_html__('General', 'shopengine'), |
| 56 | 'tab' => Controls_Manager::TAB_CONTENT, |
| 57 | ] |
| 58 | ); |
| 59 | |
| 60 | $this->add_control( |
| 61 | 'shopengine_billing_form_title', |
| 62 | [ |
| 63 | 'label' => esc_html__('Form Title', 'shopengine'), |
| 64 | 'description' => esc_html__('Title for the checkout billing form', 'shopengine'), |
| 65 | 'type' => Controls_Manager::TEXT, |
| 66 | 'separator' => 'after', |
| 67 | 'label_block' => true, |
| 68 | ] |
| 69 | ); |
| 70 | |
| 71 | $this->add_control( |
| 72 | 'shopengine_layout_heading_status', |
| 73 | [ |
| 74 | 'label' => esc_html__('Enable Default Title', 'shopengine'), |
| 75 | 'type' => Controls_Manager::SWITCHER, |
| 76 | 'label_on' => esc_html__('Yes', 'shopengine'), |
| 77 | 'label_off' => esc_html__('No', 'shopengine'), |
| 78 | 'return_value' => 'yes', |
| 79 | 'selectors' => [ |
| 80 | '{{WRAPPER}} .shopengine-checkout-form-billing .woocommerce-billing-fields > h3' => 'display: block;', |
| 81 | ], |
| 82 | 'default' => 'yes', |
| 83 | ] |
| 84 | ); |
| 85 | $this->end_controls_section(); |
| 86 | |
| 87 | /** |
| 88 | * Style Controls |
| 89 | */ |
| 90 | $this->start_controls_section( |
| 91 | 'shopengine_title_section', |
| 92 | [ |
| 93 | 'label' => esc_html__('Form Title', 'shopengine'), |
| 94 | 'tab' => Controls_Manager::TAB_STYLE, |
| 95 | ] |
| 96 | ); |
| 97 | |
| 98 | $this->add_control( |
| 99 | 'shopengine_title_color', |
| 100 | [ |
| 101 | 'label' => esc_html__('Color', 'shopengine'), |
| 102 | 'type' => \Elementor\Controls_Manager::COLOR, |
| 103 | 'alpha' => false, |
| 104 | 'default' => '#3A3A3A', |
| 105 | 'selectors' => [ |
| 106 | '{{WRAPPER}} .shopengine-checkout-form-billing .woocommerce-billing-fields > h3' => 'color: {{VALUE}}', |
| 107 | ], |
| 108 | 'condition' => [ |
| 109 | 'shopengine_layout_heading_status' => 'yes', |
| 110 | ], |
| 111 | ] |
| 112 | ); |
| 113 | |
| 114 | $this->add_responsive_control( |
| 115 | 'shopengine_title_font_size', |
| 116 | [ |
| 117 | 'label' => esc_html__('Font Size (px)', 'shopengine'), |
| 118 | 'type' => Controls_Manager::SLIDER, |
| 119 | 'size_units' => ['px'], |
| 120 | 'range' => [ |
| 121 | 'px' => [ |
| 122 | 'min' => 0, |
| 123 | 'max' => 64, |
| 124 | ], |
| 125 | ], |
| 126 | 'default' => [ |
| 127 | 'size' => 22, |
| 128 | ], |
| 129 | 'selectors' => [ |
| 130 | '{{WRAPPER}} .shopengine-checkout-form-billing .woocommerce-billing-fields > .shopengine-billing-address-header' => 'font-size: {{SIZE}}{{UNIT}} !important;', |
| 131 | ], |
| 132 | 'condition' => [ |
| 133 | 'shopengine_layout_heading_status' => 'yes', |
| 134 | ], |
| 135 | ] |
| 136 | ); |
| 137 | |
| 138 | $this->add_responsive_control( |
| 139 | 'shopengine_title_margin', |
| 140 | [ |
| 141 | 'label' => esc_html__('Margin', 'shopengine'), |
| 142 | 'type' => Controls_Manager::DIMENSIONS, |
| 143 | 'size_units' => ['px'], |
| 144 | 'default' => [ |
| 145 | 'unit' => 'px', |
| 146 | 'top' => 0, |
| 147 | 'right' => 0, |
| 148 | 'bottom' => 25, |
| 149 | 'left' => 0, |
| 150 | 'isLinked' => true, |
| 151 | ], |
| 152 | 'selectors' => [ |
| 153 | '{{WRAPPER}} .shopengine-checkout-form-billing .woocommerce-billing-fields > h3' => 'margin: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};', |
| 154 | '.rtl {{WRAPPER}} .shopengine-checkout-form-billing .woocommerce-billing-fields > h3' => 'margin: {{TOP}}{{UNIT}} {{LEFT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{RIGHT}}{{UNIT}};', |
| 155 | ], |
| 156 | 'condition' => [ |
| 157 | 'shopengine_layout_heading_status' => 'yes', |
| 158 | ], |
| 159 | ] |
| 160 | ); |
| 161 | |
| 162 | $this->end_controls_section(); |
| 163 | |
| 164 | /*================================ |
| 165 | Checkout Form Visibility Start |
| 166 | |
| 167 | - shopengine_hide_billing_first_name_field |
| 168 | - shopengine_hide_billing_last_name_field |
| 169 | - shopengine_hide_billing_company_field |
| 170 | - shopengine_hide_billing_country_field |
| 171 | - shopengine_hide_billing_address_1_field |
| 172 | - shopengine_hide_billing_address_2_field |
| 173 | - shopengine_hide_billing_city_field |
| 174 | - shopengine_hide_billing_state_field |
| 175 | - shopengine_hide_billing_postcode_field |
| 176 | - shopengine_hide_billing_phone_field |
| 177 | - shopengine_hide_billing_email_field |
| 178 | |
| 179 | ==================================*/ |
| 180 | |
| 181 | $this->start_controls_section( |
| 182 | 'shopengine_checkout_form_visibility', |
| 183 | [ |
| 184 | 'label' => esc_html__('Field Visibility', 'shopengine'), |
| 185 | 'tab' => Controls_Manager::TAB_STYLE, |
| 186 | ] |
| 187 | ); |
| 188 | |
| 189 | $this->add_control( |
| 190 | 'shopengine_hide_billing_first_name_field', |
| 191 | [ |
| 192 | 'label' => esc_html__('Hide First Name', 'shopengine'), |
| 193 | 'type' => Controls_Manager::SWITCHER, |
| 194 | 'label_on' => esc_html__('Yes', 'shopengine'), |
| 195 | 'label_off' => esc_html__('No', 'shopengine'), |
| 196 | 'return_value' => 'yes', |
| 197 | 'selectors' => [ |
| 198 | '{{WRAPPER}} .shopengine-checkout-form-billing .woocommerce-billing-fields #billing_first_name_field' => 'display: none;', |
| 199 | ], |
| 200 | ] |
| 201 | ); |
| 202 | |
| 203 | $this->add_control( |
| 204 | 'shopengine_hide_billing_last_name_field', |
| 205 | [ |
| 206 | 'label' => esc_html__('Hide Last Name', 'shopengine'), |
| 207 | 'type' => Controls_Manager::SWITCHER, |
| 208 | 'label_on' => esc_html__('Yes', 'shopengine'), |
| 209 | 'label_off' => esc_html__('No', 'shopengine'), |
| 210 | 'return_value' => 'yes', |
| 211 | 'selectors' => [ |
| 212 | '{{WRAPPER}} .shopengine-checkout-form-billing .woocommerce-billing-fields #billing_last_name_field' => 'display: none;', |
| 213 | ], |
| 214 | ] |
| 215 | ); |
| 216 | |
| 217 | $this->add_control( |
| 218 | 'shopengine_hide_billing_company_field', |
| 219 | [ |
| 220 | 'label' => esc_html__('Hide Company Name', 'shopengine'), |
| 221 | 'type' => Controls_Manager::SWITCHER, |
| 222 | 'label_on' => esc_html__('Yes', 'shopengine'), |
| 223 | 'label_off' => esc_html__('No', 'shopengine'), |
| 224 | 'return_value' => 'yes', |
| 225 | 'selectors' => [ |
| 226 | '{{WRAPPER}} .shopengine-checkout-form-billing .woocommerce-billing-fields #billing_company_field' => 'display: none;', |
| 227 | ], |
| 228 | ] |
| 229 | ); |
| 230 | |
| 231 | $this->add_control( |
| 232 | 'shopengine_hide_billing_country_field', |
| 233 | [ |
| 234 | 'label' => esc_html__('Hide Country/Region Name', 'shopengine'), |
| 235 | 'type' => Controls_Manager::SWITCHER, |
| 236 | 'label_on' => esc_html__('Yes', 'shopengine'), |
| 237 | 'label_off' => esc_html__('No', 'shopengine'), |
| 238 | 'return_value' => 'yes', |
| 239 | 'selectors' => [ |
| 240 | '{{WRAPPER}} .shopengine-checkout-form-billing .woocommerce-billing-fields #billing_country_field' => 'display: none;', |
| 241 | ], |
| 242 | ] |
| 243 | ); |
| 244 | |
| 245 | $this->add_control( |
| 246 | 'shopengine_hide_billing_address_1_field', |
| 247 | [ |
| 248 | 'label' => esc_html__('Hide Street Address 1', 'shopengine'), |
| 249 | 'type' => Controls_Manager::SWITCHER, |
| 250 | 'label_on' => esc_html__('Yes', 'shopengine'), |
| 251 | 'label_off' => esc_html__('No', 'shopengine'), |
| 252 | 'return_value' => 'yes', |
| 253 | 'selectors' => [ |
| 254 | '{{WRAPPER}} .shopengine-checkout-form-billing .woocommerce-billing-fields #billing_address_1_field' => 'display: none;', |
| 255 | ], |
| 256 | ] |
| 257 | ); |
| 258 | |
| 259 | $this->add_control( |
| 260 | 'shopengine_hide_billing_address_2_field', |
| 261 | [ |
| 262 | 'label' => esc_html__('Hide Street Address 2', 'shopengine'), |
| 263 | 'type' => Controls_Manager::SWITCHER, |
| 264 | 'label_on' => esc_html__('Yes', 'shopengine'), |
| 265 | 'label_off' => esc_html__('No', 'shopengine'), |
| 266 | 'return_value' => 'yes', |
| 267 | 'selectors' => [ |
| 268 | '{{WRAPPER}} .shopengine-checkout-form-billing .woocommerce-billing-fields #billing_address_2_field' => 'display: none;', |
| 269 | ], |
| 270 | ] |
| 271 | ); |
| 272 | |
| 273 | $this->add_control( |
| 274 | 'shopengine_hide_billing_city_field', |
| 275 | [ |
| 276 | 'label' => esc_html__('Hide town/city', 'shopengine'), |
| 277 | 'type' => Controls_Manager::SWITCHER, |
| 278 | 'label_on' => esc_html__('Yes', 'shopengine'), |
| 279 | 'label_off' => esc_html__('No', 'shopengine'), |
| 280 | 'return_value' => 'yes', |
| 281 | 'selectors' => [ |
| 282 | '{{WRAPPER}} .shopengine-checkout-form-billing .woocommerce-billing-fields #billing_city_field' => 'display: none;', |
| 283 | ], |
| 284 | ] |
| 285 | ); |
| 286 | |
| 287 | |
| 288 | $this->add_control( |
| 289 | 'shopengine_hide_billing_state_field', |
| 290 | [ |
| 291 | 'label' => esc_html__('Hide state', 'shopengine'), |
| 292 | 'type' => Controls_Manager::SWITCHER, |
| 293 | 'label_on' => esc_html__('Yes', 'shopengine'), |
| 294 | 'label_off' => esc_html__('No', 'shopengine'), |
| 295 | 'return_value' => 'yes', |
| 296 | 'selectors' => [ |
| 297 | '{{WRAPPER}} .shopengine-checkout-form-billing .woocommerce-billing-fields #billing_state_field' => 'display: none;', |
| 298 | ], |
| 299 | ] |
| 300 | ); |
| 301 | |
| 302 | $this->add_control( |
| 303 | 'shopengine_hide_billing_postcode_field', |
| 304 | [ |
| 305 | 'label' => esc_html__('Hide ZIP/Postcode', 'shopengine'), |
| 306 | 'type' => Controls_Manager::SWITCHER, |
| 307 | 'label_on' => esc_html__('Yes', 'shopengine'), |
| 308 | 'label_off' => esc_html__('No', 'shopengine'), |
| 309 | 'return_value' => 'yes', |
| 310 | 'selectors' => [ |
| 311 | '{{WRAPPER}} .shopengine-checkout-form-billing .woocommerce-billing-fields #billing_postcode_field' => 'display: none;', |
| 312 | ], |
| 313 | ] |
| 314 | ); |
| 315 | |
| 316 | $this->add_control( |
| 317 | 'shopengine_hide_billing_phone_field', |
| 318 | [ |
| 319 | 'label' => esc_html__('Hide phone', 'shopengine'), |
| 320 | 'type' => Controls_Manager::SWITCHER, |
| 321 | 'label_on' => esc_html__('Yes', 'shopengine'), |
| 322 | 'label_off' => esc_html__('No', 'shopengine'), |
| 323 | 'return_value' => 'yes', |
| 324 | 'selectors' => [ |
| 325 | '{{WRAPPER}} .shopengine-checkout-form-billing .woocommerce-billing-fields #billing_phone_field' => 'display: none;', |
| 326 | ], |
| 327 | ] |
| 328 | ); |
| 329 | |
| 330 | $this->add_control( |
| 331 | 'shopengine_hide_billing_email_field', |
| 332 | [ |
| 333 | 'label' => esc_html__('Hide email address', 'shopengine'), |
| 334 | 'type' => Controls_Manager::SWITCHER, |
| 335 | 'label_on' => esc_html__('Yes', 'shopengine'), |
| 336 | 'label_off' => esc_html__('No', 'shopengine'), |
| 337 | 'return_value' => 'yes', |
| 338 | 'selectors' => [ |
| 339 | '{{WRAPPER}} .shopengine-checkout-form-billing .woocommerce-billing-fields #billing_email_field' => 'display: none;', |
| 340 | ], |
| 341 | ] |
| 342 | ); |
| 343 | |
| 344 | $this->add_control( |
| 345 | 'shopengine_hide_login_field', |
| 346 | [ |
| 347 | 'label' => esc_html__('User Login', 'shopengine'), |
| 348 | 'type' => Controls_Manager::SWITCHER, |
| 349 | 'label_on' => esc_html__('Yes', 'shopengine'), |
| 350 | 'label_off' => esc_html__('No', 'shopengine'), |
| 351 | 'return_value' => 'yes', |
| 352 | 'selectors' => [ |
| 353 | '{{WRAPPER}} .shopengine-checkout-form-billing .create-account' => 'display: none;', |
| 354 | ], |
| 355 | ] |
| 356 | ); |
| 357 | |
| 358 | $this->end_controls_section(); |
| 359 | /*================================ |
| 360 | Checkout Form Visibility end |
| 361 | ==================================*/ |
| 362 | |
| 363 | $this->start_controls_section( |
| 364 | 'shopengine_form_container_section', |
| 365 | [ |
| 366 | 'label' => esc_html__('Form Container', 'shopengine'), |
| 367 | 'tab' => Controls_Manager::TAB_STYLE, |
| 368 | ] |
| 369 | ); |
| 370 | |
| 371 | $this->add_control( |
| 372 | 'shopengine_form_container_background', |
| 373 | [ |
| 374 | 'label' => esc_html__('Container Background', 'shopengine'), |
| 375 | 'type' => Controls_Manager::COLOR, |
| 376 | 'alpha' => false, |
| 377 | 'default' => '#f7f8fb', |
| 378 | 'selectors' => [ |
| 379 | '{{WRAPPER}} .shopengine-checkout-form-billing .woocommerce-billing-fields .woocommerce-billing-fields__field-wrapper' => 'background-color: {{VALUE}};', |
| 380 | ], |
| 381 | ] |
| 382 | ); |
| 383 | |
| 384 | $this->add_control( |
| 385 | 'shopengine_continer_alignment', |
| 386 | [ |
| 387 | 'label' => esc_html__('Alignment', 'shopengine'), |
| 388 | 'type' => Controls_Manager::CHOOSE, |
| 389 | 'options' => [ |
| 390 | 'left' => [ |
| 391 | 'title' => esc_html__('Left', 'shopengine'), |
| 392 | 'icon' => 'eicon-text-align-left', |
| 393 | ], |
| 394 | 'right' => [ |
| 395 | 'title' => esc_html__('Right', 'shopengine'), |
| 396 | 'icon' => 'eicon-text-align-right', |
| 397 | ], |
| 398 | ], |
| 399 | 'selectors' => [ |
| 400 | '{{WRAPPER}} .shopengine-checkout-form-billing .woocommerce-billing-fields .woocommerce-billing-fields__field-wrapper' => 'text-align: {{VALUE}};', |
| 401 | '{{WRAPPER}} .shopengine-checkout-form-billing .woocommerce-billing-fields .woocommerce-billing-fields__field-wrapper .woocommerce-input-wrapper input' => 'text-align: {{VALUE}};', |
| 402 | '{{WRAPPER}} .shopengine-checkout-form-billing .woocommerce-billing-fields .woocommerce-billing-fields__field-wrapper .woocommerce-input-wrapper select' => 'text-align: {{VALUE}};', |
| 403 | |
| 404 | '.rtl {{WRAPPER}}.elementor-align-left :is(.shopengine-checkout-form-billing .woocommerce-billing-fields .woocommerce-billing-fields__field-wrapper, .shopengine-billing-address-header)' => 'text-align:right;', |
| 405 | '.rtl {{WRAPPER}}.elementor-align-right :is(.shopengine-checkout-form-billing .woocommerce-billing-fields .woocommerce-billing-fields__field-wrapper, .shopengine-billing-address-header)' => 'text-align:left;', |
| 406 | |
| 407 | '.rtl {{WRAPPER}}.elementor-align-left .shopengine-checkout-form-billing .woocommerce-billing-fields .woocommerce-billing-fields__field-wrapper .woocommerce-input-wrapper :is(input, select)' => 'text-align:right;', |
| 408 | '.rtl {{WRAPPER}}.elementor-align-right .shopengine-checkout-form-billing .woocommerce-billing-fields .woocommerce-billing-fields__field-wrapper .woocommerce-input-wrapper :is(input, select)' => 'text-align:left;', |
| 409 | ], |
| 410 | 'prefix_class' => 'elementor-align-', |
| 411 | ] |
| 412 | ); |
| 413 | |
| 414 | |
| 415 | $this->add_responsive_control( |
| 416 | 'shopengine_form_container_padding', |
| 417 | [ |
| 418 | 'label' => esc_html__('Padding (px)', 'shopengine'), |
| 419 | 'type' => Controls_Manager::DIMENSIONS, |
| 420 | 'size_units' => ['px'], |
| 421 | 'default' => [ |
| 422 | 'top' => 25, |
| 423 | 'right' => 30, |
| 424 | 'bottom' => 25, |
| 425 | 'left' => 30, |
| 426 | ], |
| 427 | 'selectors' => [ |
| 428 | '{{WRAPPER}} .shopengine-checkout-form-billing .woocommerce-billing-fields .woocommerce-billing-fields__field-wrapper' => 'padding: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};', |
| 429 | |
| 430 | '.rtl {{WRAPPER}} .shopengine-checkout-form-billing .woocommerce-billing-fields .woocommerce-billing-fields__field-wrapper' => 'padding: {{TOP}}{{UNIT}} {{LEFT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{RIGHT}}{{UNIT}};', |
| 431 | ], |
| 432 | ] |
| 433 | ); |
| 434 | |
| 435 | $this->end_controls_section(); |
| 436 | |
| 437 | /* |
| 438 | --------------------------- |
| 439 | Form Label start |
| 440 | --------------------------- |
| 441 | */ |
| 442 | |
| 443 | $this->start_controls_section( |
| 444 | 'shopengine_input_label_section', |
| 445 | [ |
| 446 | 'label' => esc_html__('Label', 'shopengine'), |
| 447 | 'tab' => Controls_Manager::TAB_STYLE, |
| 448 | ] |
| 449 | ); |
| 450 | |
| 451 | $this->add_control( |
| 452 | 'shopengine_input_label_color', |
| 453 | [ |
| 454 | 'label' => esc_html__('Color', 'shopengine'), |
| 455 | 'type' => \Elementor\Controls_Manager::COLOR, |
| 456 | 'alpha' => false, |
| 457 | 'default' => '#3A3A3A', |
| 458 | 'alpha' => false, |
| 459 | 'selectors' => [ |
| 460 | '{{WRAPPER}} .shopengine-checkout-form-billing .woocommerce-billing-fields__field-wrapper .form-row label' => 'color: {{VALUE}}', |
| 461 | ], |
| 462 | ] |
| 463 | ); |
| 464 | |
| 465 | $this->add_control( |
| 466 | 'shopengine_input_required_indicator_color', |
| 467 | [ |
| 468 | 'label' => esc_html__('Required Indicator Color:', 'shopengine'), |
| 469 | 'type' => Controls_Manager::COLOR, |
| 470 | 'alpha' => false, |
| 471 | 'default' => '#3A3A3A', |
| 472 | 'selectors' => [ |
| 473 | '{{WRAPPER}} .shopengine-checkout-form-billing .woocommerce-billing-fields__field-wrapper .form-row label abbr' => 'color: {{VALUE}}', |
| 474 | ], |
| 475 | ] |
| 476 | ); |
| 477 | |
| 478 | $this->add_control( |
| 479 | 'shopengine_label_font_size', |
| 480 | [ |
| 481 | 'label' => esc_html__('Font Size (px)', 'shopengine'), |
| 482 | 'type' => Controls_Manager::SLIDER, |
| 483 | 'size_units' => ['px'], |
| 484 | 'range' => [ |
| 485 | 'px' => [ |
| 486 | 'min' => 0, |
| 487 | 'max' => 64, |
| 488 | ], |
| 489 | ], |
| 490 | 'default' => [ |
| 491 | 'size' => 16, |
| 492 | ], |
| 493 | 'selectors' => [ |
| 494 | '{{WRAPPER}} .shopengine-checkout-form-billing .woocommerce-billing-fields__field-wrapper .form-row label' => 'font-size: {{SIZE}}{{UNIT}};', |
| 495 | ], |
| 496 | ] |
| 497 | ); |
| 498 | |
| 499 | $this->add_responsive_control( |
| 500 | 'shopengine_input_label_margin', |
| 501 | [ |
| 502 | 'label' => esc_html__('Margin (px)', 'shopengine'), |
| 503 | 'type' => Controls_Manager::DIMENSIONS, |
| 504 | 'size_units' => ['px'], |
| 505 | 'selectors' => [ |
| 506 | '{{WRAPPER}} .shopengine-checkout-form-billing .woocommerce-billing-fields__field-wrapper .form-row label' => 'margin: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};', |
| 507 | '.rtl {{WRAPPER}} .shopengine-checkout-form-billing .woocommerce-billing-fields__field-wrapper .form-row label' => 'margin: {{TOP}}{{UNIT}} {{LEFT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{RIGHT}}{{UNIT}};', |
| 508 | ], |
| 509 | ] |
| 510 | ); |
| 511 | |
| 512 | $this->end_controls_section(); // end ./ form label |
| 513 | |
| 514 | |
| 515 | /* |
| 516 | --------------------------- |
| 517 | Form Input |
| 518 | --------------------------- |
| 519 | */ |
| 520 | |
| 521 | $this->start_controls_section( |
| 522 | 'shopengine_input_section', |
| 523 | [ |
| 524 | 'label' => esc_html__('Input', 'shopengine'), |
| 525 | 'tab' => Controls_Manager::TAB_STYLE, |
| 526 | ] |
| 527 | ); |
| 528 | |
| 529 | $this->start_controls_tabs('shopengine_input_tabs_style'); |
| 530 | |
| 531 | $this->start_controls_tab( |
| 532 | 'shopengine_input_tabnormal', |
| 533 | [ |
| 534 | 'label' => esc_html__('Normal', 'shopengine'), |
| 535 | ] |
| 536 | ); |
| 537 | |
| 538 | $this->add_control( |
| 539 | 'shopengine_input_color', |
| 540 | [ |
| 541 | 'label' => esc_html__('Input Color', 'shopengine'), |
| 542 | 'type' => Controls_Manager::COLOR, |
| 543 | 'default' => '#555555', |
| 544 | 'alpha' => false, |
| 545 | 'selectors' => [ |
| 546 | '{{WRAPPER}} .shopengine-checkout-form-billing .woocommerce-billing-fields__field-wrapper :is(input, textarea, .woocommerce-input-wrapper .select2-selection, select)' => 'color: {{VALUE}};', |
| 547 | ], |
| 548 | ] |
| 549 | ); |
| 550 | |
| 551 | $this->add_control( |
| 552 | 'shopengine_input_background', |
| 553 | [ |
| 554 | 'label' => esc_html__('Background', 'shopengine'), |
| 555 | 'type' => Controls_Manager::COLOR, |
| 556 | 'default' => '#ffffff', |
| 557 | 'selectors' => [ |
| 558 | '{{WRAPPER}} .shopengine-checkout-form-billing .woocommerce-billing-fields__field-wrapper :is(input, textarea, .select2-selection, select)' => 'background-color: {{VALUE}};', |
| 559 | ], |
| 560 | ] |
| 561 | ); |
| 562 | |
| 563 | $this->add_responsive_control( |
| 564 | 'shopengine_input_font_size', |
| 565 | [ |
| 566 | 'label' => esc_html__('Font Size (px)', 'shopengine'), |
| 567 | 'type' => Controls_Manager::SLIDER, |
| 568 | 'size_units' => ['px'], |
| 569 | 'range' => [ |
| 570 | 'px' => [ |
| 571 | 'min' => 0, |
| 572 | 'max' => 100, |
| 573 | ], |
| 574 | ], |
| 575 | 'default' => [ |
| 576 | 'size' => 16, |
| 577 | ], |
| 578 | 'selectors' => [ |
| 579 | '{{WRAPPER}} .shopengine-checkout-form-billing .woocommerce-billing-fields__field-wrapper .form-row :is(input, textarea, .select2-selection, select)' => 'font-size: {{SIZE}}{{UNIT}} !important;', |
| 580 | ], |
| 581 | ] |
| 582 | ); |
| 583 | |
| 584 | $this->add_group_control( |
| 585 | Group_Control_Border::get_type(), |
| 586 | [ |
| 587 | 'name' => 'shopengine_input_border', |
| 588 | 'label' => esc_html__('Border', 'shopengine'), |
| 589 | 'fields_options' => [ |
| 590 | 'border' => [ |
| 591 | 'default' => 'solid', |
| 592 | ], |
| 593 | 'width' => [ |
| 594 | 'responsive' => false, |
| 595 | 'default' => [ |
| 596 | 'top' => 1, |
| 597 | 'right' => 1, |
| 598 | 'bottom' => 1, |
| 599 | 'left' => 1, |
| 600 | 'isLinked' => true, |
| 601 | ], |
| 602 | 'selectors' => [ |
| 603 | '{{WRAPPER}} .shopengine-checkout-form-billing .woocommerce-billing-fields__field-wrapper :is(input, textarea, .woocommerce-input-wrapper .select2-selection, select)' => 'border-width: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}}', |
| 604 | '.rtl {{WRAPPER}} .shopengine-checkout-form-billing .woocommerce-billing-fields__field-wrapper :is(input, textarea, .woocommerce-input-wrapper .select2-selection, select)' => 'border-width: {{TOP}}{{UNIT}} {{LEFT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{RIGHT}}{{UNIT}}', |
| 605 | ] |
| 606 | ], |
| 607 | 'color' => [ |
| 608 | 'default' => '#dee3ea', |
| 609 | 'alpha' => false, |
| 610 | ], |
| 611 | ], |
| 612 | 'selector' => '{{WRAPPER}} .shopengine-checkout-form-billing .woocommerce-billing-fields__field-wrapper :is(input, textarea, .woocommerce-input-wrapper .select2-selection, select)', |
| 613 | ] |
| 614 | ); |
| 615 | |
| 616 | $this->end_controls_tab(); |
| 617 | |
| 618 | $this->start_controls_tab( |
| 619 | 'shopengine_input_tabfocus', |
| 620 | [ |
| 621 | 'label' => esc_html__('Focus', 'shopengine'), |
| 622 | ] |
| 623 | ); |
| 624 | |
| 625 | $this->add_control( |
| 626 | 'shopengine_input_color_focus', |
| 627 | [ |
| 628 | 'label' => esc_html__('Input Color', 'shopengine'), |
| 629 | 'type' => Controls_Manager::COLOR, |
| 630 | 'default' => '#555555', |
| 631 | 'alpha' => false, |
| 632 | 'selectors' => [ |
| 633 | '{{WRAPPER}} .shopengine-checkout-form-billing .woocommerce-billing-fields__field-wrapper :is(input, textarea, .select2-selection, select):focus' => 'color: {{VALUE}};', |
| 634 | ], |
| 635 | ] |
| 636 | ); |
| 637 | |
| 638 | $this->add_control( |
| 639 | 'shopengine_input_background_focus', |
| 640 | [ |
| 641 | 'label' => esc_html__('Background', 'shopengine'), |
| 642 | 'type' => Controls_Manager::COLOR, |
| 643 | 'default' => '#ffffff', |
| 644 | 'alpha' => false, |
| 645 | 'selectors' => [ |
| 646 | '{{WRAPPER}} .shopengine-checkout-form-billing .woocommerce-billing-fields__field-wrapper :is(input, textarea, .select2-selection, select):focus' => 'background-color: {{VALUE}};' |
| 647 | ], |
| 648 | ] |
| 649 | ); |
| 650 | |
| 651 | $this->add_group_control( |
| 652 | Group_Control_Border::get_type(), |
| 653 | [ |
| 654 | 'name' => 'shopengine_input_border_focus', |
| 655 | 'label' => esc_html__('Border', 'shopengine'), |
| 656 | 'selector' => '{{WRAPPER}} .shopengine-checkout-form-billing .woocommerce-billing-fields__field-wrapper :is(input, textarea, .select2-selection, select):focus', |
| 657 | 'fields_options' => [ |
| 658 | 'width' => [ |
| 659 | 'label' => esc_html__('Border Width', 'shopengine'), |
| 660 | 'responsive' => false, |
| 661 | 'selectors' => [ |
| 662 | '{{WRAPPER}} .shopengine-checkout-form-billing .woocommerce-billing-fields__field-wrapper :is(input, textarea, .select2-selection, select):focus' => 'border-width: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}}', |
| 663 | '.rtl {{WRAPPER}} .shopengine-checkout-form-billing .woocommerce-billing-fields__field-wrapper :is(input, textarea, .select2-selection, select):focus' => 'border-width: {{TOP}}{{UNIT}} {{LEFT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{RIGHT}}{{UNIT}}', |
| 664 | ] |
| 665 | ], |
| 666 | ], |
| 667 | ] |
| 668 | ); |
| 669 | |
| 670 | $this->end_controls_tab(); |
| 671 | |
| 672 | $this->end_controls_tabs(); |
| 673 | |
| 674 | $this->add_responsive_control( |
| 675 | 'shopengine_input_padding', |
| 676 | [ |
| 677 | 'label' => esc_html__('Padding', 'shopengine'), |
| 678 | 'type' => Controls_Manager::DIMENSIONS, |
| 679 | 'size_units' => ['px'], |
| 680 | 'default' => [ |
| 681 | 'top' => 10, |
| 682 | 'right' => 16, |
| 683 | 'bottom' => 10, |
| 684 | 'left' => 16, |
| 685 | ], |
| 686 | 'selectors' => [ |
| 687 | '{{WRAPPER}} .shopengine-checkout-form-billing .woocommerce-billing-fields__field-wrapper :is(input, textarea, .woocommerce-input-wrapper .select2-selection, select)' => 'padding: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}} !important;', |
| 688 | '.rtl {{WRAPPER}} .shopengine-checkout-form-billing .woocommerce-billing-fields__field-wrapper :is(input, textarea, .woocommerce-input-wrapper .select2-selection, select)' => 'padding: {{TOP}}{{UNIT}} {{LEFT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{RIGHT}}{{UNIT}} !important;', |
| 689 | ], |
| 690 | 'separator' => 'before', |
| 691 | ] |
| 692 | ); |
| 693 | |
| 694 | $this->add_control( |
| 695 | 'shopengine_checkout_form_billing_input_border_radius', |
| 696 | [ |
| 697 | 'label' => esc_html__('Border Radius (px)', 'shopengine'), |
| 698 | 'type' => Controls_Manager::DIMENSIONS, |
| 699 | 'size_units' => ['px'], |
| 700 | 'size_units' => ['px'], |
| 701 | 'default' => [ |
| 702 | 'top' => '3', |
| 703 | 'right' => '3', |
| 704 | 'bottom' => '3', |
| 705 | 'left' => '3', |
| 706 | 'unit' => 'px', |
| 707 | 'isLinked' => true, |
| 708 | ], |
| 709 | 'selectors' => [ |
| 710 | '{{WRAPPER}} .shopengine-checkout-form-billing .woocommerce-billing-fields__field-wrapper :is(input, textarea, .woocommerce-input-wrapper .select2-selection, select)' => 'border-radius: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}} !important;', |
| 711 | '.rtl {{WRAPPER}} .shopengine-checkout-form-billing .woocommerce-billing-fields__field-wrapper :is(input, textarea, .woocommerce-input-wrapper .select2-selection, select)' => 'border-radius: {{TOP}}{{UNIT}} {{LEFT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{RIGHT}}{{UNIT}} !important;' |
| 712 | ], |
| 713 | ] |
| 714 | ); |
| 715 | |
| 716 | $this->add_control( |
| 717 | 'shopengine_input_arrow_position', |
| 718 | [ |
| 719 | 'label' => esc_html__('Input Arrow In-between', 'shopengine'), |
| 720 | 'type' => Controls_Manager::SLIDER, |
| 721 | 'size_units' => ['px'], |
| 722 | 'range' => [ |
| 723 | 'px' => [ |
| 724 | 'min' => 0, |
| 725 | 'max' => 50, |
| 726 | 'step' => 5, |
| 727 | ], |
| 728 | ], |
| 729 | 'default' => [ |
| 730 | 'unit' => 'px', |
| 731 | 'size' => 15, |
| 732 | ], |
| 733 | 'selectors' => [ |
| 734 | '{{WRAPPER}} .select2.select2-container .select2-selection--single::before' => 'right:{{SIZE}}{{UNIT}};', |
| 735 | ], |
| 736 | ] |
| 737 | ); |
| 738 | |
| 739 | |
| 740 | |
| 741 | |
| 742 | $this->add_control( |
| 743 | 'shopengine_input_color_placeholder', |
| 744 | [ |
| 745 | 'label' => esc_html__('Placeholder Color', 'shopengine'), |
| 746 | 'type' => Controls_Manager::COLOR, |
| 747 | 'default' => '#555555', |
| 748 | 'alpha' => false, |
| 749 | 'selectors' => [ |
| 750 | '{{WRAPPER}} .shopengine-checkout-form-billing .woocommerce-billing-fields__field-wrapper :is(input, textarea, .woocommerce-input-wrapper .select2-selection, select)::placeholder' => 'color: {{VALUE}};', |
| 751 | ], |
| 752 | ] |
| 753 | ); |
| 754 | |
| 755 | |
| 756 | $this->end_controls_section(); |
| 757 | |
| 758 | /** |
| 759 | * Typography Section |
| 760 | */ |
| 761 | $this->start_controls_section( |
| 762 | 'shopengine_typography_section', |
| 763 | [ |
| 764 | 'label' => esc_html__('Global Font', 'shopengine'), |
| 765 | 'tab' => Controls_Manager::TAB_STYLE, |
| 766 | ] |
| 767 | ); |
| 768 | |
| 769 | $this->add_group_control( |
| 770 | Group_Control_Typography::get_type(), |
| 771 | [ |
| 772 | 'name' => 'shopengine_typography_primary', |
| 773 | 'label' => esc_html__('Primary Typography', 'shopengine'), |
| 774 | 'selector' => '{{WRAPPER}} .shopengine-checkout-form-billing .woocommerce-billing-fields > h3, {{WRAPPER}} .shopengine-checkout-form-billing .woocommerce-billing-fields__field-wrapper .form-row label', |
| 775 | 'exclude' => ['letter_spacing', 'font_size', 'text_decoration', 'font_style', 'line_height'], |
| 776 | 'fields_options' => [ |
| 777 | 'typography' => [ |
| 778 | 'default' => 'custom', |
| 779 | ], |
| 780 | 'font_weight' => [ |
| 781 | 'default' => '400', |
| 782 | ], |
| 783 | 'font_size' => [ |
| 784 | 'label' => esc_html__('Font Size (px)', 'shopengine'), |
| 785 | 'default' => [ |
| 786 | 'size' => '16', |
| 787 | 'unit' => 'px', |
| 788 | ], |
| 789 | 'size_units' => ['px'], |
| 790 | ], |
| 791 | ], |
| 792 | ] |
| 793 | ); |
| 794 | |
| 795 | $this->add_control( |
| 796 | 'shopengine_typography_primary_desc', |
| 797 | [ |
| 798 | 'type' => Controls_Manager::RAW_HTML, |
| 799 | 'raw' => esc_html__('Primary Typography : Form Title & Form Label', 'shopengine'), |
| 800 | 'content_classes' => 'elementor-control-field-description', |
| 801 | 'separator' => 'after', |
| 802 | ] |
| 803 | ); |
| 804 | |
| 805 | $this->add_group_control( |
| 806 | Group_Control_Typography::get_type(), |
| 807 | [ |
| 808 | 'name' => 'shopengine_typography_seconday', |
| 809 | 'label' => esc_html__('Secondary Typography', 'shopengine'), |
| 810 | 'selector' => '{{WRAPPER}} .shopengine-checkout-form-billing .woocommerce-billing-fields__field-wrapper .form-row input, |
| 811 | {{WRAPPER}} .shopengine-checkout-form-billing .woocommerce-billing-fields__field-wrapper .form-row textarea, |
| 812 | {{WRAPPER}} .shopengine-checkout-form-billing .woocommerce-billing-fields__field-wrapper .form-row .select2-selection', |
| 813 | 'exclude' => ['font_style','font_size', 'letter_spacing','line_height', 'text_decoration'], |
| 814 | 'fields_options' => [ |
| 815 | 'typography' => [ |
| 816 | 'default' => 'custom', |
| 817 | ], |
| 818 | 'font_weight' => [ |
| 819 | 'default' => '400', |
| 820 | ], |
| 821 | 'font_size' => [ |
| 822 | 'label' => esc_html__('Font Size (px)', 'shopengine'), |
| 823 | 'default' => [ |
| 824 | 'size' => '16', |
| 825 | 'unit' => 'px', |
| 826 | ], |
| 827 | 'size_units' => ['px'], |
| 828 | ], |
| 829 | ], |
| 830 | ] |
| 831 | ); |
| 832 | |
| 833 | $this->add_control( |
| 834 | 'shopengine_typography_secondary_desc', |
| 835 | [ |
| 836 | 'type' => Controls_Manager::RAW_HTML, |
| 837 | 'raw' => esc_html__('Secondary Typography : Form Input', 'shopengine'), |
| 838 | 'content_classes' => 'elementor-control-field-description', |
| 839 | ] |
| 840 | ); |
| 841 | |
| 842 | $this->end_controls_section(); |
| 843 | } |
| 844 | |
| 845 | |
| 846 | protected function screen() { |
| 847 | |
| 848 | $settings = $this->get_settings_for_display(); |
| 849 | |
| 850 | Helper::order_checkout_fields( $settings['shopengine_billing_inputs'] ); |
| 851 | |
| 852 | $tpl = Products::instance()->get_widget_template($this->get_name()); |
| 853 | |
| 854 | include $tpl; |
| 855 | } |
| 856 | } |
| 857 |