| @@ -465,13 +465,19 @@ | ||
| 465 | 465 | 'label' => __( 'Round Amounts', 'better-payment' ), |
| 466 | 466 | 'type' => 'toggle', |
| 467 | 467 | 'defaultValue' => false, |
| 468 | 468 | ], |
| 469 | + // Both of these are PREFIXES — RendererService prints the live | |
| 470 | + // value straight after them ("Donated: 40%", "Goal: €5,000"). The | |
| 471 | + // `info` text says so because the field name alone does not, and | |
| 472 | + // an author (or the AI, which reads this schema) who types the | |
| 473 | + // whole phrase gets the value rendered twice. | |
| 469 | 474 | [ |
| 470 | 475 | 'key' => 'donate_label', |
| 471 | 476 | 'label' => __( 'Donate Label:', 'better-payment' ), |
| 472 | 477 | 'type' => 'text', |
| 473 | 478 | 'defaultValue' => 'Donated:', |
| 479 | + 'info' => __( 'Shown before the progress percentage — the percentage is added automatically. Do not type a number here.', 'better-payment' ), | |
| 474 | 480 | ], |
| 475 | 481 | [ |
| 476 | 482 | 'key' => 'goal_label', |
| 477 | 483 | 'label' => __( 'Goal Label:', 'better-payment' ), |
| @@ -476,8 +482,9 @@ | ||
| 476 | 482 | 'key' => 'goal_label', |
| 477 | 483 | 'label' => __( 'Goal Label:', 'better-payment' ), |
| 478 | 484 | 'type' => 'text', |
| 479 | 485 | 'defaultValue' => 'Goal:', |
| 486 | + 'info' => __( 'Shown before the goal amount — the amount and currency are added automatically. Do not type an amount here.', 'better-payment' ), | |
| 480 | 487 | ], |
| 481 | 488 | [ |
| 482 | 489 | 'key' => 'width', |
| 483 | 490 | 'label' => __( 'Width', 'better-payment' ), |
| @@ -609,8 +616,9 @@ | ||
| 609 | 616 | 'type' => 'range', |
| 610 | 617 | 'min' => 10, |
| 611 | 618 | 'max' => 100, |
| 612 | 619 | 'step' => 1, |
| 620 | + 'unit' => '%', | |
| 613 | 621 | 'defaultValue' => 100, |
| 614 | 622 | ], |
| 615 | 623 | [ |
| 616 | 624 | 'key' => 'align', |
| @@ -668,8 +676,9 @@ | ||
| 668 | 676 | 'type' => 'range', |
| 669 | 677 | 'min' => 10, |
| 670 | 678 | 'max' => 100, |
| 671 | 679 | 'step' => 1, |
| 680 | + 'unit' => '%', | |
| 672 | 681 | 'defaultValue' => 100, |
| 673 | 682 | 'info' => __( 'Width of the organizer block as a percentage.', 'better-payment' ), |
| 674 | 683 | ], |
| 675 | 684 | [ |
| @@ -685,8 +694,10 @@ | ||
| 685 | 694 | 'label' => __( 'Donate Amount', 'better-payment' ), |
| 686 | 695 | 'icon' => 'money-alt', |
| 687 | 696 | 'defaultSettings' => [ |
| 688 | 697 | 'headline' => 'Donate Amount', |
| 698 | + 'width' => 100, | |
| 699 | + 'align' => 'left', | |
| 689 | 700 | ], |
| 690 | 701 | 'settingsSchema' => [ |
| 691 | 702 | [ |
| 692 | 703 | 'key' => 'headline', |
| @@ -715,8 +726,25 @@ | ||
| 715 | 726 | 'type' => 'switch', |
| 716 | 727 | 'metaKey' => 'bpc_allow_custom_amount', |
| 717 | 728 | 'defaultValue' => true, |
| 718 | 729 | ], |
| 730 | + [ | |
| 731 | + 'key' => 'width', | |
| 732 | + 'label' => __( 'Width', 'better-payment' ), | |
| 733 | + 'type' => 'range', | |
| 734 | + 'min' => 10, | |
| 735 | + 'max' => 100, | |
| 736 | + 'step' => 1, | |
| 737 | + 'unit' => '%', | |
| 738 | + 'defaultValue' => 100, | |
| 739 | + 'info' => __( 'Controls the width of the donation amounts relative to its container.', 'better-payment' ), | |
| 740 | + ], | |
| 741 | + [ | |
| 742 | + 'key' => 'align', | |
| 743 | + 'label' => __( 'Align', 'better-payment' ), | |
| 744 | + 'type' => 'align', | |
| 745 | + 'defaultValue' => 'left', | |
| 746 | + ], | |
| 719 | 747 | ], |
| 720 | 748 | ] ); |
| 721 | 749 | |
| 722 | 750 | ElementRegistry::register( 'social_sharing', [ |
| @@ -901,6 +929,29 @@ | ||
| 901 | 929 | 'type' => 'align', |
| 902 | 930 | ], |
| 903 | 931 | ], |
| 904 | 932 | ] ); |
| 933 | + | |
| 934 | + self::register_pro_elements(); | |
| 935 | + } | |
| 936 | + | |
| 937 | + /** | |
| 938 | + * Register the three Pro-only elements (Donors Wall, FAQ, Video) as lock stubs. | |
| 939 | + * | |
| 940 | + * Pro owns their control schemas and default settings. Lite registers only | |
| 941 | + * {@see ProElementStubs} — label, icon, the `pro` flag and an upgrade feature | |
| 942 | + * list — so a free user can drop, select, move and delete the element, see its | |
| 943 | + * mock preview, and read what Pro adds. Better Payment Pro 1.4.4+ replaces the | |
| 944 | + * entries with its full definitions on `better_payment/campaign_elements` | |
| 945 | + * (default priority) and attaches the renderers on | |
| 946 | + * `better_payment/campaign/render_element_{type}`. | |
| 947 | + * | |
| 948 | + * The `pro` flag stays on every definition whether or not Pro is installed. | |
| 949 | + * Nothing reads it as an entitlement — locking is decided by the live | |
| 950 | + * `better_payment/pro_enabled` filter, per request. | |
| 951 | + */ | |
| 952 | + private static function register_pro_elements(): void { | |
| 953 | + foreach ( ProElementStubs::get_all() as $type => $stub ) { | |
| 954 | + ElementRegistry::register( $type, $stub ); | |
| 955 | + } | |
| 905 | 956 | } |
| 906 | 957 | } |