← All changes
|
includes/page-form-builder/form-settings/options-defs.php
+132
-2
11.4
→
11.9
View file →
| @@ -32,8 +32,12 @@ | ||
| 32 | 32 | function wpbc_bfb_ui__settings_options__print() { |
| 33 | 33 | |
| 34 | 34 | $wpbc_bfb_current_form_style = function_exists( 'wpbc_bfb_settings__get_current_form_style' ) ? wpbc_bfb_settings__get_current_form_style() : 'light_bordered'; |
| 35 | 35 | $wpbc_bfb_custom_style_values = function_exists( 'wpbc_bfb_settings__get_custom_form_style_options' ) ? wpbc_bfb_settings__get_custom_form_style_options() : array(); |
| 36 | + $wpbc_bfb_accent_values = function_exists( 'wpbc_bfb_settings__get_form_accent_options' ) ? wpbc_bfb_settings__get_form_accent_options() : array( | |
| 37 | + 'booking_form_accent_enabled' => 'Off', | |
| 38 | + 'booking_form_accent_color' => WPBC_DEFAULT_FORM_ACCENT_COLOR, | |
| 39 | + ); | |
| 36 | 40 | |
| 37 | 41 | // ====================================================================== |
| 38 | 42 | // == Group: Basic |
| 39 | 43 | // ====================================================================== |
| @@ -131,8 +135,72 @@ | ||
| 131 | 135 | ) |
| 132 | 136 | ); |
| 133 | 137 | |
| 134 | 138 | |
| 139 | + WPBC_BFB_Setting_Options::print_option( | |
| 140 | + array( | |
| 141 | + 'type' => 'toggle', | |
| 142 | + 'key' => 'booking_form_accent_enabled', | |
| 143 | + 'scope' => 'global', | |
| 144 | + 'save_ui' => 'when_changed', | |
| 145 | + 'autosave_on_form_save' => true, | |
| 146 | + 'default' => $wpbc_bfb_accent_values['booking_form_accent_enabled'], | |
| 147 | + 'label' => __( 'Custom accent color', 'booking' ), | |
| 148 | + 'help' => __( 'Use one accent for preset-style primary buttons, secondary-button hover borders, focused fields, selected choices, and navigation accents. Custom style keeps its explicitly configured button colors. Time slots use the accent only with the Automatic time-slot style.', 'booking' ), | |
| 149 | + 'attr' => array( | |
| 150 | + 'id' => 'booking_form_accent_enabled', | |
| 151 | + ), | |
| 152 | + ) | |
| 153 | + ); | |
| 154 | + | |
| 155 | + WPBC_BFB_Setting_Options::print_option( | |
| 156 | + array( | |
| 157 | + 'type' => 'color', | |
| 158 | + 'key' => 'booking_form_accent_color', | |
| 159 | + 'scope' => 'global', | |
| 160 | + 'save_ui' => 'when_changed', | |
| 161 | + 'autosave_on_form_save' => true, | |
| 162 | + 'default' => $wpbc_bfb_accent_values['booking_form_accent_color'], | |
| 163 | + 'label' => __( 'Accent color', 'booking' ), | |
| 164 | + 'help' => __( 'Choose the shared interactive color. Preset styles calculate readable primary button text and hover colors automatically; Custom style uses its explicit button settings.', 'booking' ), | |
| 165 | + 'attr' => array( | |
| 166 | + 'id' => 'booking_form_accent_color', | |
| 167 | + ), | |
| 168 | + 'row_class' => 'wpbc_bfb__form_setting_global_accent_color wpbc_bfb__form_setting_global_accent_dependent', | |
| 169 | + 'row_hidden' => ( 'On' !== $wpbc_bfb_accent_values['booking_form_accent_enabled'] ), | |
| 170 | + 'input_attrs' => array( | |
| 171 | + 'pattern' => '^#[0-9A-Fa-f]{6}$', | |
| 172 | + ), | |
| 173 | + ) | |
| 174 | + ); | |
| 175 | + | |
| 176 | + ?> | |
| 177 | + <div class="wpbc_bfb__form_setting wpbc-setting wpbc_bfb__form_setting_global_accent_components wpbc_bfb__form_setting_global_accent_dependent" | |
| 178 | + id="booking_form_accent_apply_to_components" | |
| 179 | + data-scope="ui" | |
| 180 | + data-key="booking_form_accent_apply_to_components" | |
| 181 | + <?php echo ( 'On' === $wpbc_bfb_accent_values['booking_form_accent_enabled'] ) ? '' : ' hidden aria-hidden="true"'; // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped ?> > | |
| 182 | + <div class="inspector__row" style="justify-content:flex-start;"> | |
| 183 | + <div class="inspector__control" style="flex:1 1 auto;"> | |
| 184 | + <button type="button" | |
| 185 | + class="button button-secondary" | |
| 186 | + data-wpbc-bfb-apply-accent-components="1" | |
| 187 | + data-wpbc-u-save-name="booking_timeslot_picker_skin" | |
| 188 | + data-wpbc-u-save-value="/css/time_picker_skins/form_style.css" | |
| 189 | + data-wpbc-u-save-callback="wpbc_bfb_time_picker_skin_saved" | |
| 190 | + data-wpbc-time-picker-skin-current="<?php echo esc_attr( get_bk_option( 'booking_timeslot_picker_skin' ) ); ?>" | |
| 191 | + data-wpbc-time-picker-skin-url="<?php echo esc_url( wpbc_plugin_url( '/css/time_picker_skins/form_style.css' ) ); ?>"> | |
| 192 | + <?php esc_html_e( 'Apply accent to form elements', 'booking' ); ?> | |
| 193 | + </button> | |
| 194 | + <p class="wpbc_bfb__help" style="margin:6px 0 0 0;"> | |
| 195 | + <?php esc_html_e( 'Copy the current accent color into supported elements, such as Steps Timeline, and switch time slots to Automatic — Match Booking Form. Element colors remain editable afterward. Save the form to keep element changes.', 'booking' ); ?> | |
| 196 | + </p> | |
| 197 | + <p class="wpbc_bfb__help" role="status" aria-live="polite" data-wpbc-bfb-accent-components-status="1" style="margin:6px 0 0 0;"></p> | |
| 198 | + </div> | |
| 199 | + </div> | |
| 200 | + </div> | |
| 201 | + <?php | |
| 202 | + | |
| 135 | 203 | // Combined global style selector. It uses the same option as Settings > Theme. |
| 136 | 204 | WPBC_BFB_Setting_Options::print_option( |
| 137 | 205 | array( |
| 138 | 206 | 'type' => 'radio', |
| @@ -145,10 +213,10 @@ | ||
| 145 | 213 | 'help' => __( 'Choose the global form style used by all booking forms.', 'booking' ), |
| 146 | 214 | 'attr' => array( |
| 147 | 215 | 'id' => 'booking_form_style', |
| 148 | 216 | ), |
| 149 | - 'radio_layout' => 'choice_grid', | |
| 150 | - 'options' => function_exists( 'wpbc_bfb_settings__get_form_style_options' ) ? wpbc_bfb_settings__get_form_style_options() : array( | |
| 217 | + 'radio_layout' => 'choice_grid', | |
| 218 | + 'options' => function_exists( 'wpbc_bfb_settings__get_form_style_options' ) ? wpbc_bfb_settings__get_form_style_options() : array( | |
| 151 | 219 | 'light_bordered' => __( 'Light bordered', 'booking' ), |
| 152 | 220 | 'custom' => __( 'Custom', 'booking' ), |
| 153 | 221 | ), |
| 154 | 222 | ) |
| @@ -560,8 +628,70 @@ | ||
| 560 | 628 | ), |
| 561 | 629 | ) |
| 562 | 630 | ); |
| 563 | 631 | } |
| 632 | + | |
| 633 | + WPBC_BFB_Setting_Options::print_option( | |
| 634 | + array( | |
| 635 | + 'type' => 'length', | |
| 636 | + 'key' => 'booking_form_custom_button_border_width', | |
| 637 | + 'scope' => 'global', | |
| 638 | + 'save_ui' => 'when_changed', | |
| 639 | + 'autosave_on_form_save' => true, | |
| 640 | + 'default' => isset( $wpbc_bfb_custom_style_values['booking_form_custom_button_border_width'] ) ? $wpbc_bfb_custom_style_values['booking_form_custom_button_border_width'] : '1px', | |
| 641 | + 'label' => __( 'Button border width', 'booking' ), | |
| 642 | + 'help' => __( 'Used by primary and secondary buttons when Form style is Custom.', 'booking' ), | |
| 643 | + 'attr' => array( | |
| 644 | + 'id' => 'booking_form_custom_button_border_width', | |
| 645 | + ), | |
| 646 | + 'row_class' => 'wpbc_bfb__form_setting_global_custom_style', | |
| 647 | + 'row_hidden' => true, | |
| 648 | + 'length' => array( | |
| 649 | + 'default_unit' => 'px', | |
| 650 | + 'units' => array( | |
| 651 | + 'px' => 'px', | |
| 652 | + 'rem' => 'rem', | |
| 653 | + 'em' => 'em', | |
| 654 | + ), | |
| 655 | + 'bounds_map' => array( | |
| 656 | + 'px' => array( 'min' => 0, 'max' => 20, 'step' => 1 ), | |
| 657 | + 'rem' => array( 'min' => 0, 'max' => 5, 'step' => 0.1 ), | |
| 658 | + 'em' => array( 'min' => 0, 'max' => 5, 'step' => 0.1 ), | |
| 659 | + ), | |
| 660 | + ), | |
| 661 | + ) | |
| 662 | + ); | |
| 663 | + | |
| 664 | + WPBC_BFB_Setting_Options::print_option( | |
| 665 | + array( | |
| 666 | + 'type' => 'length', | |
| 667 | + 'key' => 'booking_form_custom_button_border_radius', | |
| 668 | + 'scope' => 'global', | |
| 669 | + 'save_ui' => 'when_changed', | |
| 670 | + 'autosave_on_form_save' => true, | |
| 671 | + 'default' => isset( $wpbc_bfb_custom_style_values['booking_form_custom_button_border_radius'] ) ? $wpbc_bfb_custom_style_values['booking_form_custom_button_border_radius'] : '3px', | |
| 672 | + 'label' => __( 'Button corner radius', 'booking' ), | |
| 673 | + 'help' => __( 'Used by primary and secondary buttons when Form style is Custom.', 'booking' ), | |
| 674 | + 'attr' => array( | |
| 675 | + 'id' => 'booking_form_custom_button_border_radius', | |
| 676 | + ), | |
| 677 | + 'row_class' => 'wpbc_bfb__form_setting_global_custom_style', | |
| 678 | + 'row_hidden' => true, | |
| 679 | + 'length' => array( | |
| 680 | + 'default_unit' => 'px', | |
| 681 | + 'units' => array( | |
| 682 | + 'px' => 'px', | |
| 683 | + 'rem' => 'rem', | |
| 684 | + 'em' => 'em', | |
| 685 | + ), | |
| 686 | + 'bounds_map' => array( | |
| 687 | + 'px' => array( 'min' => 0, 'max' => 40, 'step' => 1 ), | |
| 688 | + 'rem' => array( 'min' => 0, 'max' => 5, 'step' => 0.1 ), | |
| 689 | + 'em' => array( 'min' => 0, 'max' => 5, 'step' => 0.1 ), | |
| 690 | + ), | |
| 691 | + ), | |
| 692 | + ) | |
| 693 | + ); | |
| 564 | 694 | |
| 565 | 695 | ?> |
| 566 | 696 | <div class="wpbc_bfb__form_setting wpbc_bfb__form_setting_custom_appearance_reset" data-wpbc-bfb-custom-appearance-reset-row="1" hidden aria-hidden="true" style="border: 1.5px dashed #dd4e4e;"> |
| 567 | 697 | <div class="inspector__row" style="justify-content:flex-start;"> |