← All changes
|
app/Elementor/Widgets/Controls/AddToCartSettings.php
+44
-161
3.4.2
→
3.2.6
View file →
| @@ -170,9 +170,9 @@ | ||
| 170 | 170 | 'max' => 50, |
| 171 | 171 | ], |
| 172 | 172 | ], |
| 173 | 173 | 'default' => [ |
| 174 | - 'size' => 10, | |
| 174 | + 'size' => 15, | |
| 175 | 175 | ], |
| 176 | 176 | 'selectors' => [ |
| 177 | 177 | self::$selectors['icon_size'] => 'font-size: {{SIZE}}{{UNIT}};', |
| 178 | 178 | ], |
| @@ -321,29 +321,30 @@ | ||
| 321 | 321 | * @return array |
| 322 | 322 | */ |
| 323 | 323 | public static function variation_style_fields() { |
| 324 | 324 | $fields = [ |
| 325 | - 'variation_section' => [ | |
| 325 | + 'variation_section' => [ | |
| 326 | 326 | 'mode' => 'section_start', |
| 327 | 327 | 'tab' => 'style', |
| 328 | 328 | 'label' => esc_html__( 'Variations', 'shopbuilder' ), |
| 329 | 329 | ], |
| 330 | - 'variation_label_heading' => [ | |
| 331 | - 'type' => 'html', | |
| 332 | - 'raw' => sprintf( | |
| 333 | - '<h3 class="rtsb-elementor-group-heading">%s</h3>', | |
| 334 | - esc_html__( 'Label', 'shopbuilder' ) | |
| 335 | - ), | |
| 336 | - 'content_classes' => 'elementor-panel-heading-title', | |
| 337 | - ], | |
| 338 | - 'variation_label_typography' => [ | |
| 330 | + 'variation_label_typography' => [ | |
| 339 | 331 | 'type' => 'typography', |
| 332 | + 'separator' => 'before', | |
| 340 | 333 | 'mode' => 'group', |
| 341 | 334 | 'label' => esc_html__( 'Label Typography', 'shopbuilder' ), |
| 342 | 335 | 'description' => esc_html__( 'Only for Variation Label.', 'shopbuilder' ), |
| 343 | 336 | 'selector' => self::$selectors['variation_label_typography'], |
| 344 | 337 | ], |
| 345 | - 'variation_label_color' => [ | |
| 338 | + 'variation_stock_typography' => [ | |
| 339 | + 'type' => 'typography', | |
| 340 | + 'separator' => 'before', | |
| 341 | + 'mode' => 'group', | |
| 342 | + 'label' => esc_html__( 'Stock Typography', 'shopbuilder' ), | |
| 343 | + 'description' => esc_html__( 'Only for variation stock.', 'shopbuilder' ), | |
| 344 | + 'selector' => self::$selectors['variation_stock_typography'], | |
| 345 | + ], | |
| 346 | + 'variation_label_color' => [ | |
| 346 | 347 | 'label' => esc_html__( 'Label Color', 'shopbuilder' ), |
| 347 | 348 | 'type' => 'color', |
| 348 | 349 | 'selectors' => [ |
| 349 | 350 | self::$selectors['variation_label_color'] => 'color: {{VALUE}}', |
| @@ -348,33 +349,9 @@ | ||
| 348 | 349 | 'selectors' => [ |
| 349 | 350 | self::$selectors['variation_label_color'] => 'color: {{VALUE}}', |
| 350 | 351 | ], |
| 351 | 352 | ], |
| 352 | - 'variation_label_margin' => [ | |
| 353 | - 'label' => esc_html__( 'Label Margin', 'shopbuilder' ), | |
| 354 | - 'type' => 'dimensions', | |
| 355 | - 'size_units' => [ 'px', '%', 'em' ], | |
| 356 | - 'selectors' => [ | |
| 357 | - self::$selectors['variation_label_margin'] => 'margin: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}} !important;', | |
| 358 | - ], | |
| 359 | - ], | |
| 360 | - 'variation_stock_heading' => [ | |
| 361 | - 'type' => 'html', | |
| 362 | - 'raw' => sprintf( | |
| 363 | - '<h3 class="rtsb-elementor-group-heading">%s</h3>', | |
| 364 | - esc_html__( 'Stock', 'shopbuilder' ) | |
| 365 | - ), | |
| 366 | - 'content_classes' => 'elementor-panel-heading-title', | |
| 367 | - 'separator' => 'before', | |
| 368 | - ], | |
| 369 | - 'variation_stock_typography' => [ | |
| 370 | - 'type' => 'typography', | |
| 371 | - 'mode' => 'group', | |
| 372 | - 'label' => esc_html__( 'Stock Typography', 'shopbuilder' ), | |
| 373 | - 'description' => esc_html__( 'Only for variation stock.', 'shopbuilder' ), | |
| 374 | - 'selector' => self::$selectors['variation_stock_typography'], | |
| 375 | - ], | |
| 376 | - 'variation_stock_color' => [ | |
| 353 | + 'variation_stock_color' => [ | |
| 377 | 354 | 'label' => esc_html__( 'Stock Color', 'shopbuilder' ), |
| 378 | 355 | 'type' => 'color', |
| 379 | 356 | 'selectors' => [ |
| 380 | 357 | self::$selectors['variation_stock_color'] => 'color: {{VALUE}}', |
| @@ -379,9 +356,9 @@ | ||
| 379 | 356 | 'selectors' => [ |
| 380 | 357 | self::$selectors['variation_stock_color'] => 'color: {{VALUE}}', |
| 381 | 358 | ], |
| 382 | 359 | ], |
| 383 | - 'variation_outofstock_color' => [ | |
| 360 | + 'variation_outofstock_color' => [ | |
| 384 | 361 | 'label' => esc_html__( 'Out of Stock Color', 'shopbuilder' ), |
| 385 | 362 | 'type' => 'color', |
| 386 | 363 | 'selectors' => [ |
| 387 | 364 | self::$selectors['variation_outofstock_color'] => 'color: {{VALUE}}', |
| @@ -386,18 +363,9 @@ | ||
| 386 | 363 | 'selectors' => [ |
| 387 | 364 | self::$selectors['variation_outofstock_color'] => 'color: {{VALUE}}', |
| 388 | 365 | ], |
| 389 | 366 | ], |
| 390 | - 'variation_swatch_heading' => [ | |
| 391 | - 'type' => 'html', | |
| 392 | - 'raw' => sprintf( | |
| 393 | - '<h3 class="rtsb-elementor-group-heading">%s</h3>', | |
| 394 | - esc_html__( 'Variation Items', 'shopbuilder' ) | |
| 395 | - ), | |
| 396 | - 'content_classes' => 'elementor-panel-heading-title', | |
| 397 | - 'separator' => 'before', | |
| 398 | - ], | |
| 399 | - 'variation_height' => [ | |
| 367 | + 'variation_height' => [ | |
| 400 | 368 | 'label' => esc_html__( 'Height', 'shopbuilder' ), |
| 401 | 369 | 'type' => 'slider', |
| 402 | 370 | 'range' => [ |
| 403 | 371 | 'px' => [ |
| @@ -404,15 +372,11 @@ | ||
| 404 | 372 | 'min' => 10, |
| 405 | 373 | 'max' => 200, |
| 406 | 374 | ], |
| 407 | 375 | ], |
| 408 | - // 40px gives the label room to sit on its own line-height. The old 30px | |
| 409 | - // was fine on its own, but this widget also applies variation_padding to | |
| 410 | - // the same elements, and with border-box that left ~10px of content | |
| 411 | - // height — enough to squash/clip the term and select labels. | |
| 412 | 376 | 'default' => [ |
| 413 | 377 | 'unit' => 'px', |
| 414 | - 'size' => '40', | |
| 378 | + 'size' => '30', | |
| 415 | 379 | ], |
| 416 | 380 | 'selectors' => [ |
| 417 | 381 | self::$selectors['variation_height'] => 'height: {{SIZE}}{{UNIT}};', |
| 418 | 382 | ':root' => '--details-page-attr-height:{{SIZE}}{{UNIT}};', |
| @@ -417,9 +381,9 @@ | ||
| 417 | 381 | self::$selectors['variation_height'] => 'height: {{SIZE}}{{UNIT}};', |
| 418 | 382 | ':root' => '--details-page-attr-height:{{SIZE}}{{UNIT}};', |
| 419 | 383 | ], |
| 420 | 384 | ], |
| 421 | - 'variation_width' => [ | |
| 385 | + 'variation_width' => [ | |
| 422 | 386 | 'label' => esc_html__( 'Min Width', 'shopbuilder' ), |
| 423 | 387 | 'size_units' => [ 'px', '%' ], |
| 424 | 388 | 'type' => 'slider', |
| 425 | 389 | 'range' => [ |
| @@ -431,12 +395,11 @@ | ||
| 431 | 395 | 'min' => 0, |
| 432 | 396 | 'max' => 100, |
| 433 | 397 | ], |
| 434 | 398 | ], |
| 435 | - // Matches the height so single-character terms (S, M, L) stay square. | |
| 436 | 399 | 'default' => [ |
| 437 | 400 | 'unit' => 'px', |
| 438 | - 'size' => '40', | |
| 401 | + 'size' => '30', | |
| 439 | 402 | ], |
| 440 | 403 | 'selectors' => [ |
| 441 | 404 | self::$selectors['variation_width'] => 'min-width: {{SIZE}}{{UNIT}};', |
| 442 | 405 | ':root' => '--details-page-attr-width:{{SIZE}}{{UNIT}};', |
| @@ -441,37 +404,15 @@ | ||
| 441 | 404 | self::$selectors['variation_width'] => 'min-width: {{SIZE}}{{UNIT}};', |
| 442 | 405 | ':root' => '--details-page-attr-width:{{SIZE}}{{UNIT}};', |
| 443 | 406 | ], |
| 444 | 407 | ], |
| 445 | - 'variation_padding' => [ | |
| 446 | - 'label' => esc_html__( 'Padding ', 'shopbuilder' ), | |
| 447 | - 'description' => sprintf( '<span style="color:#e01e1e;">%s</span>', esc_html__( 'Note: Only for Select And Button Field.', 'shopbuilder' ) ), | |
| 448 | - 'type' => 'dimensions', | |
| 449 | - 'size_units' => [ 'px' ], | |
| 450 | - // Horizontal only. These elements already have a fixed height, so vertical | |
| 451 | - // padding fights it rather than adding breathing room — the label ends up | |
| 452 | - // squashed against the top/bottom edge (or clipped) instead of centred. | |
| 453 | - 'default' => [ | |
| 454 | - 'top' => '0', | |
| 455 | - 'right' => '10', | |
| 456 | - 'bottom' => '0', | |
| 457 | - 'left' => '10', | |
| 458 | - 'unit' => 'px', | |
| 459 | - 'isLinked' => false, | |
| 460 | - ], | |
| 461 | - 'separator' => 'default', | |
| 462 | - 'selectors' => [ | |
| 463 | - self::$selectors['variation_padding'] => 'padding: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};', | |
| 464 | - ':root' => '--variation-padding:{{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};', | |
| 465 | - ], | |
| 466 | - ], | |
| 467 | - 'variation_border' => [ | |
| 408 | + 'variation_border' => [ | |
| 468 | 409 | 'mode' => 'group', |
| 469 | 410 | 'type' => 'border', |
| 470 | - 'label' => esc_html__( 'Border', 'shopbuilder' ), | |
| 411 | + 'label' => esc_html__( 'Quantity Border', 'shopbuilder' ), | |
| 471 | 412 | 'selector' => self::$selectors['variation_border'], |
| 472 | 413 | ], |
| 473 | - 'variation_border_radius' => [ | |
| 414 | + 'variation_border_radius' => [ | |
| 474 | 415 | 'label' => esc_html__( 'Border Radius', 'shopbuilder' ), |
| 475 | 416 | 'size_units' => [ 'px', '%' ], |
| 476 | 417 | 'type' => 'slider', |
| 477 | 418 | 'selectors' => [ |
| @@ -478,102 +419,44 @@ | ||
| 478 | 419 | self::$selectors['variation_border_radius'] => 'border-radius: {{SIZE}}{{UNIT}};', |
| 479 | 420 | ':root' => '--variation-attr-border-radius:{{SIZE}}{{UNIT}};', |
| 480 | 421 | ], |
| 481 | 422 | ], |
| 482 | - 'variation_swatch_border_color' => [ | |
| 483 | - 'label' => esc_html__( 'Swatch Border Color', 'shopbuilder' ), | |
| 484 | - 'type' => 'color', | |
| 485 | - 'description' => esc_html__( 'Border color of the swatch items (Variation Swatches module).', 'shopbuilder' ), | |
| 486 | - 'selectors' => [ | |
| 487 | - self::$selectors['variation_swatch_border_color'] => '--attribute-border-color: {{VALUE}};', | |
| 423 | + 'variation_padding' => [ | |
| 424 | + 'label' => esc_html__( 'Padding ', 'shopbuilder' ), | |
| 425 | + 'description' => esc_html__( 'Note: Only for Select And Button Field.', 'shopbuilder' ), | |
| 426 | + 'type' => 'dimensions', | |
| 427 | + 'size_units' => [ 'px' ], | |
| 428 | + 'default' => [ | |
| 429 | + 'top' => '10', | |
| 430 | + 'right' => '10', | |
| 431 | + 'bottom' => '10', | |
| 432 | + 'left' => '10', | |
| 433 | + 'unit' => 'px', | |
| 434 | + 'isLinked' => true, | |
| 488 | 435 | ], |
| 489 | - ], | |
| 490 | - 'variation_swatch_selected_color' => [ | |
| 491 | - 'label' => esc_html__( 'Selected Swatch Border Color', 'shopbuilder' ), | |
| 492 | - 'type' => 'color', | |
| 493 | - 'description' => esc_html__( 'Border color of the hovered/selected swatch item.', 'shopbuilder' ), | |
| 436 | + 'separator' => 'default', | |
| 494 | 437 | 'selectors' => [ |
| 495 | - self::$selectors['variation_swatch_selected_color'] => '--attribute-border-color-hover: {{VALUE}};', | |
| 438 | + self::$selectors['variation_padding'] => 'padding: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};', | |
| 439 | + ':root' => '--variation-padding:{{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};', | |
| 496 | 440 | ], |
| 497 | 441 | ], |
| 498 | - 'variation_item_margin' => [ | |
| 499 | - 'label' => esc_html__( 'Variation Item Margin', 'shopbuilder' ), | |
| 442 | + 'variation_label_margin' => [ | |
| 443 | + 'label' => esc_html__( 'Label Margin', 'shopbuilder' ), | |
| 500 | 444 | 'type' => 'dimensions', |
| 501 | 445 | 'size_units' => [ 'px', '%', 'em' ], |
| 502 | 446 | 'selectors' => [ |
| 503 | - self::$selectors['variation_item_margin'] => 'margin: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}} !important;', | |
| 447 | + self::$selectors['variation_label_margin'] => 'margin: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}} !important;', | |
| 504 | 448 | ], |
| 505 | 449 | ], |
| 506 | - 'variation_checkmark_heading' => [ | |
| 507 | - 'type' => 'html', | |
| 508 | - 'raw' => sprintf( | |
| 509 | - '<h3 class="rtsb-elementor-group-heading">%s</h3>', | |
| 510 | - esc_html__( 'Checkmark', 'shopbuilder' ) | |
| 511 | - ), | |
| 512 | - 'content_classes' => 'elementor-panel-heading-title', | |
| 513 | - 'separator' => 'before', | |
| 514 | - ], | |
| 515 | - 'variation_checkmark_bg_color' => [ | |
| 516 | - 'label' => esc_html__( 'Background Color', 'shopbuilder' ), | |
| 517 | - 'type' => 'color', | |
| 518 | - 'selectors' => [ | |
| 519 | - self::$selectors['variation_checkmark_bg_color'] => '--checkmark-bg-color: {{VALUE}};', | |
| 520 | - ], | |
| 521 | - ], | |
| 522 | - 'variation_checkmark_size' => [ | |
| 523 | - 'label' => esc_html__( 'Size', 'shopbuilder' ), | |
| 524 | - 'type' => 'slider', | |
| 525 | - 'size_units' => [ 'px' ], | |
| 526 | - 'range' => [ | |
| 527 | - 'px' => [ | |
| 528 | - 'min' => 8, | |
| 529 | - 'max' => 50, | |
| 530 | - ], | |
| 531 | - ], | |
| 532 | - 'selectors' => [ | |
| 533 | - self::$selectors['variation_checkmark_size'] => '--checkmark-width: {{SIZE}}{{UNIT}}; --checkmark-height: {{SIZE}}{{UNIT}};', | |
| 534 | - ], | |
| 535 | - ], | |
| 536 | - 'variation_checkmark_icon_size' => [ | |
| 537 | - 'label' => esc_html__( 'Icon Size', 'shopbuilder' ), | |
| 538 | - 'type' => 'slider', | |
| 539 | - 'size_units' => [ 'px' ], | |
| 540 | - 'range' => [ | |
| 541 | - 'px' => [ | |
| 542 | - 'min' => 6, | |
| 543 | - 'max' => 40, | |
| 544 | - ], | |
| 545 | - ], | |
| 546 | - 'selectors' => [ | |
| 547 | - self::$selectors['variation_checkmark_icon_size'] => '--checkmark-font-size: {{SIZE}}{{UNIT}};', | |
| 548 | - ], | |
| 549 | - ], | |
| 550 | - 'variation_clear_heading' => [ | |
| 551 | - 'type' => 'html', | |
| 552 | - 'raw' => sprintf( | |
| 553 | - '<h3 class="rtsb-elementor-group-heading">%s</h3>', | |
| 554 | - esc_html__( 'Clear Button', 'shopbuilder' ) | |
| 555 | - ), | |
| 556 | - 'content_classes' => 'elementor-panel-heading-title', | |
| 557 | - 'separator' => 'before', | |
| 558 | - ], | |
| 559 | - 'variation_clear_margin' => [ | |
| 560 | - 'label' => esc_html__( 'Margin', 'shopbuilder' ), | |
| 450 | + 'variation_item_margin' => [ | |
| 451 | + 'label' => esc_html__( 'Variation Item Margin', 'shopbuilder' ), | |
| 561 | 452 | 'type' => 'dimensions', |
| 562 | 453 | 'size_units' => [ 'px', '%', 'em' ], |
| 563 | 454 | 'selectors' => [ |
| 564 | - self::$selectors['variation_clear_margin'] => 'margin: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}} !important;', | |
| 455 | + self::$selectors['variation_item_margin'] => 'margin: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}} !important;', | |
| 565 | 456 | ], |
| 566 | 457 | ], |
| 567 | - 'variation_clear_padding' => [ | |
| 568 | - 'label' => esc_html__( 'Padding', 'shopbuilder' ), | |
| 569 | - 'type' => 'dimensions', | |
| 570 | - 'size_units' => [ 'px', '%', 'em' ], | |
| 571 | - 'selectors' => [ | |
| 572 | - self::$selectors['variation_clear_padding'] => 'padding: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}} !important;', | |
| 573 | - ], | |
| 574 | - ], | |
| 575 | - 'variation_section_end' => [ | |
| 458 | + 'variation_section_end' => [ | |
| 576 | 459 | 'mode' => 'section_end', |
| 577 | 460 | ], |
| 578 | 461 | ]; |
| 579 | 462 | return $fields; |