← All changes
|
includes/page-settings-themes/settings_themes__page.php
+105
-14
11.4.2
→
11.9
View file →
| @@ -98,8 +98,9 @@ | ||
| 98 | 98 | trailingslashit( plugins_url( '', __FILE__ ) ) . '_out/settings_themes_page.css', |
| 99 | 99 | array( 'wpbc-calendar', 'wpbc-all-admin' ), |
| 100 | 100 | WP_BK_VERSION_NUM |
| 101 | 101 | ); |
| 102 | + wp_enqueue_style( 'coloris', wpbc_plugin_url( '/vendors/coloris/dist/coloris.min.css' ), array(), WP_BK_VERSION_NUM ); | |
| 102 | 103 | } |
| 103 | 104 | add_action( 'wpbc_enqueue_css_files', 'wpbc_settings_themes_enqueue_css_files', 66 ); |
| 104 | 105 | |
| 105 | 106 | /** |
| @@ -119,11 +120,19 @@ | ||
| 119 | 120 | return; |
| 120 | 121 | } |
| 121 | 122 | |
| 122 | 123 | wp_enqueue_script( |
| 124 | + 'coloris', | |
| 125 | + wpbc_plugin_url( '/vendors/coloris/dist/coloris.min.js' ), | |
| 126 | + array(), | |
| 127 | + WP_BK_VERSION_NUM, | |
| 128 | + array( 'in_footer' => WPBC_JS_IN_FOOTER ) | |
| 129 | + ); | |
| 130 | + | |
| 131 | + wp_enqueue_script( | |
| 123 | 132 | 'wpbc-settings-themes-page', |
| 124 | 133 | trailingslashit( plugins_url( '', __FILE__ ) ) . '_out/settings_themes_page.js', |
| 125 | - array( 'jquery', 'wpbc_all' ), | |
| 134 | + array( 'jquery', 'wpbc_all', 'coloris' ), | |
| 126 | 135 | WP_BK_VERSION_NUM, |
| 127 | 136 | array( 'in_footer' => WPBC_JS_IN_FOOTER ) |
| 128 | 137 | ); |
| 129 | 138 | |
| @@ -139,8 +148,9 @@ | ||
| 139 | 148 | 'settings' => wpbc_settings_themes__get_settings_response(), |
| 140 | 149 | 'form_style_presets' => wpbc_bfb_settings__get_form_style_presets(), |
| 141 | 150 | 'form_style_css_var_names' => wpbc_bfb_settings__get_form_style_css_var_names(), |
| 142 | 151 | 'custom_form_style_defaults' => wpbc_bfb_settings__get_default_custom_form_style_options(), |
| 152 | + 'form_accent_defaults' => wpbc_bfb_settings__get_default_form_accent_options(), | |
| 143 | 153 | 'days_selection' => wpbc_settings_themes__get_days_selection_response(), |
| 144 | 154 | 'i18n' => array( |
| 145 | 155 | 'saving' => __( 'Saving', 'booking' ), |
| 146 | 156 | 'saved' => __( 'Appearance settings updated.', 'booking' ), |
| @@ -402,9 +412,9 @@ | ||
| 402 | 412 | function wpbc_settings_themes__sanitize_preview_mode( $preview_mode ) { |
| 403 | 413 | |
| 404 | 414 | $preview_mode = sanitize_key( (string) $preview_mode ); |
| 405 | 415 | |
| 406 | - return array_key_exists( $preview_mode, wpbc_settings_themes__get_preview_mode_options() ) ? $preview_mode : 'calendar'; | |
| 416 | + return array_key_exists( $preview_mode, wpbc_settings_themes__get_preview_mode_options() ) ? $preview_mode : 'form'; | |
| 407 | 417 | } |
| 408 | 418 | |
| 409 | 419 | /** |
| 410 | 420 | * Get preview mode from request. |
| @@ -413,9 +423,9 @@ | ||
| 413 | 423 | */ |
| 414 | 424 | function wpbc_settings_themes__get_preview_mode() { |
| 415 | 425 | |
| 416 | 426 | // phpcs:ignore WordPress.Security.NonceVerification.Recommended |
| 417 | - $preview_mode = isset( $_REQUEST['preview_mode'] ) ? sanitize_key( wp_unslash( $_REQUEST['preview_mode'] ) ) : 'calendar'; | |
| 427 | + $preview_mode = isset( $_REQUEST['preview_mode'] ) ? sanitize_key( wp_unslash( $_REQUEST['preview_mode'] ) ) : 'form'; | |
| 418 | 428 | |
| 419 | 429 | return wpbc_settings_themes__sanitize_preview_mode( $preview_mode ); |
| 420 | 430 | } |
| 421 | 431 | |
| @@ -581,8 +591,9 @@ | ||
| 581 | 591 | * @return array |
| 582 | 592 | */ |
| 583 | 593 | function wpbc_settings_themes__get_time_picker_skin_options() { |
| 584 | 594 | |
| 595 | + $automatic_skin = '/css/time_picker_skins/form_style.css'; | |
| 585 | 596 | $timeslot_picker_skins_options = array(); |
| 586 | 597 | $upload_dir = wp_upload_dir(); |
| 587 | 598 | |
| 588 | 599 | if ( function_exists( 'wpbc_dir_list' ) ) { |
| @@ -598,11 +609,37 @@ | ||
| 598 | 609 | $timeslot_picker_skins_options[ $skin_file[1] ] = $skin_file[2]; |
| 599 | 610 | } |
| 600 | 611 | } |
| 601 | 612 | |
| 613 | + // Keep the integrated option first and give bundled skins readable labels. | |
| 614 | + if ( file_exists( WPBC_PLUGIN_DIR . $automatic_skin ) ) { | |
| 615 | + unset( $timeslot_picker_skins_options[ $automatic_skin ] ); | |
| 616 | + $timeslot_picker_skins_options = array_merge( | |
| 617 | + array( | |
| 618 | + $automatic_skin => __( 'Automatic — Match Booking Form', 'booking' ), | |
| 619 | + ), | |
| 620 | + $timeslot_picker_skins_options | |
| 621 | + ); | |
| 622 | + } | |
| 623 | + | |
| 624 | + $bundled_skin_titles = array( | |
| 625 | + '/css/time_picker_skins/light__24_8.css' => __( 'Light', 'booking' ), | |
| 626 | + '/css/time_picker_skins/grey.css' => __( 'Grey', 'booking' ), | |
| 627 | + '/css/time_picker_skins/black.css' => __( 'Black', 'booking' ), | |
| 628 | + '/css/time_picker_skins/blue.css' => __( 'Blue', 'booking' ), | |
| 629 | + '/css/time_picker_skins/green.css' => __( 'Green', 'booking' ), | |
| 630 | + '/css/time_picker_skins/orange.css' => __( 'Orange', 'booking' ), | |
| 631 | + '/css/time_picker_skins/marine.css' => __( 'Marine', 'booking' ), | |
| 632 | + ); | |
| 633 | + foreach ( $bundled_skin_titles as $skin_path => $skin_title ) { | |
| 634 | + if ( isset( $timeslot_picker_skins_options[ $skin_path ] ) ) { | |
| 635 | + $timeslot_picker_skins_options[ $skin_path ] = $skin_title; | |
| 636 | + } | |
| 637 | + } | |
| 638 | + | |
| 602 | 639 | if ( empty( $timeslot_picker_skins_options ) ) { |
| 603 | 640 | $default_options_values = wpbc_get_default_options(); |
| 604 | - $default_skin = isset( $default_options_values['booking_timeslot_picker_skin'] ) ? $default_options_values['booking_timeslot_picker_skin'] : '/css/time_picker_skins/grey.css'; | |
| 641 | + $default_skin = isset( $default_options_values['booking_timeslot_picker_skin'] ) ? $default_options_values['booking_timeslot_picker_skin'] : $automatic_skin; | |
| 605 | 642 | $timeslot_picker_skins_options[ $default_skin ] = __( 'Default', 'booking' ); |
| 606 | 643 | } |
| 607 | 644 | |
| 608 | 645 | return $timeslot_picker_skins_options; |
| @@ -698,8 +735,9 @@ | ||
| 698 | 735 | |
| 699 | 736 | $form_style = wpbc_bfb_settings__get_current_form_style(); |
| 700 | 737 | $transition_values = wpbc_settings_themes__map_form_style_to_options( $form_style, '' ); |
| 701 | 738 | $custom_values = wpbc_bfb_settings__get_custom_form_style_options(); |
| 739 | + $accent_values = wpbc_bfb_settings__get_form_accent_options(); | |
| 702 | 740 | |
| 703 | 741 | return array_merge( |
| 704 | 742 | array( |
| 705 | 743 | 'booking_form_style' => $form_style, |
| @@ -713,9 +751,10 @@ | ||
| 713 | 751 | 'booking_skin' => wpbc_settings_themes__normalize_calendar_skin_value( get_bk_option( 'booking_skin' ) ), |
| 714 | 752 | 'booking_timeslot_picker_skin' => get_bk_option( 'booking_timeslot_picker_skin' ), |
| 715 | 753 | 'booking_timeslot_picker' => get_bk_option( 'booking_timeslot_picker' ), |
| 716 | 754 | ), |
| 717 | - $custom_values | |
| 755 | + $custom_values, | |
| 756 | + $accent_values | |
| 718 | 757 | ); |
| 719 | 758 | } |
| 720 | 759 | |
| 721 | 760 | /** |
| @@ -752,8 +791,10 @@ | ||
| 752 | 791 | function wpbc_settings_themes__get_preview_option_overrides( $current_settings ) { |
| 753 | 792 | |
| 754 | 793 | $option_names = array( |
| 755 | 794 | 'booking_form_style', |
| 795 | + 'booking_form_accent_enabled', | |
| 796 | + 'booking_form_accent_color', | |
| 756 | 797 | 'booking_form_custom_background_color', |
| 757 | 798 | 'booking_form_custom_border_color', |
| 758 | 799 | 'booking_form_custom_border_width', |
| 759 | 800 | 'booking_form_custom_border_radius', |
| @@ -774,8 +815,10 @@ | ||
| 774 | 815 | 'booking_form_custom_secondary_button_border_color', |
| 775 | 816 | 'booking_form_custom_secondary_button_hover_background_color', |
| 776 | 817 | 'booking_form_custom_secondary_button_hover_text_color', |
| 777 | 818 | 'booking_form_custom_secondary_button_hover_border_color', |
| 819 | + 'booking_form_custom_button_border_width', | |
| 820 | + 'booking_form_custom_button_border_radius', | |
| 778 | 821 | 'booking_skin', |
| 779 | 822 | 'booking_timeslot_picker_skin', |
| 780 | 823 | 'booking_timeslot_picker', |
| 781 | 824 | ); |
| @@ -813,8 +856,9 @@ | ||
| 813 | 856 | $default_options_values = wpbc_get_default_options(); |
| 814 | 857 | $calendar_skin_options = wpbc_settings_themes__get_calendar_skin_options_for_select(); |
| 815 | 858 | $time_skin_options = wpbc_settings_themes__get_time_picker_skin_options(); |
| 816 | 859 | $custom_values = wpbc_bfb_settings__get_custom_form_style_options(); |
| 860 | + $accent_values = wpbc_bfb_settings__get_form_accent_options(); | |
| 817 | 861 | |
| 818 | 862 | $cleaned = array_merge( |
| 819 | 863 | array( |
| 820 | 864 | 'booking_form_style' => isset( $default_options_values['booking_form_style'] ) ? wpbc_bfb_settings__sanitize_form_style( $default_options_values['booking_form_style'] ) : wpbc_bfb_settings__get_default_form_style(), |
| @@ -821,9 +865,10 @@ | ||
| 821 | 865 | 'booking_skin' => isset( $default_options_values['booking_skin'] ) ? $default_options_values['booking_skin'] : '', |
| 822 | 866 | 'booking_timeslot_picker_skin' => isset( $default_options_values['booking_timeslot_picker_skin'] ) ? $default_options_values['booking_timeslot_picker_skin'] : '', |
| 823 | 867 | 'booking_timeslot_picker' => isset( $default_options_values['booking_timeslot_picker'] ) ? $default_options_values['booking_timeslot_picker'] : 'Off', |
| 824 | 868 | ), |
| 825 | - $custom_values | |
| 869 | + $custom_values, | |
| 870 | + $accent_values | |
| 826 | 871 | ); |
| 827 | 872 | |
| 828 | 873 | if ( isset( $post_data['booking_form_style'] ) ) { |
| 829 | 874 | $cleaned['booking_form_style'] = wpbc_bfb_settings__sanitize_form_style( wp_unslash( $post_data['booking_form_style'] ) ); // phpcs:ignore WordPress.Security.ValidatedSanitizedInput.InputNotSanitized |
| @@ -828,8 +873,13 @@ | ||
| 828 | 873 | if ( isset( $post_data['booking_form_style'] ) ) { |
| 829 | 874 | $cleaned['booking_form_style'] = wpbc_bfb_settings__sanitize_form_style( wp_unslash( $post_data['booking_form_style'] ) ); // phpcs:ignore WordPress.Security.ValidatedSanitizedInput.InputNotSanitized |
| 830 | 875 | } |
| 831 | 876 | |
| 877 | + $cleaned['booking_form_accent_enabled'] = ( isset( $post_data['booking_form_accent_enabled'] ) && 'On' === sanitize_text_field( wp_unslash( $post_data['booking_form_accent_enabled'] ) ) ) ? 'On' : 'Off'; | |
| 878 | + if ( isset( $post_data['booking_form_accent_color'] ) ) { | |
| 879 | + $cleaned['booking_form_accent_color'] = wpbc_bfb_settings__sanitize_form_accent_color( sanitize_text_field( wp_unslash( $post_data['booking_form_accent_color'] ) ), WPBC_DEFAULT_FORM_ACCENT_COLOR ); | |
| 880 | + } | |
| 881 | + | |
| 832 | 882 | $sanitize_color = function ( $value, $fallback ) { |
| 833 | 883 | $value = trim( sanitize_text_field( wp_unslash( $value ) ) ); |
| 834 | 884 | if ( preg_match( '/^#(?:[0-9a-f]{3}|[0-9a-f]{6})$/i', $value ) || 'transparent' === $value ) { |
| 835 | 885 | return $value; |
| @@ -837,9 +887,9 @@ | ||
| 837 | 887 | return $fallback; |
| 838 | 888 | }; |
| 839 | 889 | $sanitize_length = function ( $value, $fallback ) { |
| 840 | 890 | $value = trim( sanitize_text_field( wp_unslash( $value ) ) ); |
| 841 | - if ( preg_match( '/^-?\d+(?:\.\d+)?(?:px|rem|em|%)$/i', $value ) ) { | |
| 891 | + if ( preg_match( '/^\d+(?:\.\d+)?(?:px|rem|em|%)$/i', $value ) ) { | |
| 842 | 892 | return $value; |
| 843 | 893 | } |
| 844 | 894 | return $fallback; |
| 845 | 895 | }; |
| @@ -852,9 +902,9 @@ | ||
| 852 | 902 | if ( count( $parts ) < 1 || count( $parts ) > 4 ) { |
| 853 | 903 | return $fallback; |
| 854 | 904 | } |
| 855 | 905 | foreach ( $parts as $part ) { |
| 856 | - if ( ! preg_match( '/^-?\d+(?:\.\d+)?(?:px|rem|em|%)$/i', $part ) ) { | |
| 906 | + if ( ! preg_match( '/^\d+(?:\.\d+)?(?:px|rem|em|%)$/i', $part ) ) { | |
| 857 | 907 | return $fallback; |
| 858 | 908 | } |
| 859 | 909 | } |
| 860 | 910 | return implode( ' ', $parts ); |
| @@ -926,8 +976,14 @@ | ||
| 926 | 976 | } |
| 927 | 977 | if ( isset( $post_data['booking_form_custom_secondary_button_hover_border_color'] ) ) { |
| 928 | 978 | $cleaned['booking_form_custom_secondary_button_hover_border_color'] = $sanitize_color( $post_data['booking_form_custom_secondary_button_hover_border_color'], '#4d91cd' ); |
| 929 | 979 | } |
| 980 | + if ( isset( $post_data['booking_form_custom_button_border_width'] ) ) { | |
| 981 | + $cleaned['booking_form_custom_button_border_width'] = $sanitize_length( $post_data['booking_form_custom_button_border_width'], '1px' ); | |
| 982 | + } | |
| 983 | + if ( isset( $post_data['booking_form_custom_button_border_radius'] ) ) { | |
| 984 | + $cleaned['booking_form_custom_button_border_radius'] = $sanitize_length( $post_data['booking_form_custom_button_border_radius'], '3px' ); | |
| 985 | + } | |
| 930 | 986 | } |
| 931 | 987 | |
| 932 | 988 | if ( isset( $post_data['booking_skin'] ) ) { |
| 933 | 989 | $value = wpbc_settings_themes__normalize_calendar_skin_value( sanitize_text_field( wp_unslash( $post_data['booking_skin'] ) ) ); |
| @@ -959,8 +1015,10 @@ | ||
| 959 | 1015 | */ |
| 960 | 1016 | function wpbc_settings_themes__update_settings( $cleaned_data ) { |
| 961 | 1017 | |
| 962 | 1018 | update_bk_option( 'booking_form_style', $cleaned_data['booking_form_style'] ); |
| 1019 | + update_bk_option( 'booking_form_accent_enabled', $cleaned_data['booking_form_accent_enabled'] ); | |
| 1020 | + update_bk_option( 'booking_form_accent_color', $cleaned_data['booking_form_accent_color'] ); | |
| 963 | 1021 | update_bk_option( 'booking_form_custom_background_color', $cleaned_data['booking_form_custom_background_color'] ); |
| 964 | 1022 | update_bk_option( 'booking_form_custom_border_color', $cleaned_data['booking_form_custom_border_color'] ); |
| 965 | 1023 | update_bk_option( 'booking_form_custom_border_width', $cleaned_data['booking_form_custom_border_width'] ); |
| 966 | 1024 | update_bk_option( 'booking_form_custom_border_radius', $cleaned_data['booking_form_custom_border_radius'] ); |
| @@ -981,8 +1039,10 @@ | ||
| 981 | 1039 | update_bk_option( 'booking_form_custom_secondary_button_border_color', $cleaned_data['booking_form_custom_secondary_button_border_color'] ); |
| 982 | 1040 | update_bk_option( 'booking_form_custom_secondary_button_hover_background_color', $cleaned_data['booking_form_custom_secondary_button_hover_background_color'] ); |
| 983 | 1041 | update_bk_option( 'booking_form_custom_secondary_button_hover_text_color', $cleaned_data['booking_form_custom_secondary_button_hover_text_color'] ); |
| 984 | 1042 | update_bk_option( 'booking_form_custom_secondary_button_hover_border_color', $cleaned_data['booking_form_custom_secondary_button_hover_border_color'] ); |
| 1043 | + update_bk_option( 'booking_form_custom_button_border_width', $cleaned_data['booking_form_custom_button_border_width'] ); | |
| 1044 | + update_bk_option( 'booking_form_custom_button_border_radius', $cleaned_data['booking_form_custom_button_border_radius'] ); | |
| 985 | 1045 | update_bk_option( 'booking_skin', $cleaned_data['booking_skin'] ); |
| 986 | 1046 | update_bk_option( 'booking_timeslot_picker_skin', $cleaned_data['booking_timeslot_picker_skin'] ); |
| 987 | 1047 | update_bk_option( 'booking_timeslot_picker', $cleaned_data['booking_timeslot_picker'] ); |
| 988 | 1048 | } |
| @@ -1078,9 +1138,9 @@ | ||
| 1078 | 1138 | * @param array $preview_settings Optional settings. |
| 1079 | 1139 | * |
| 1080 | 1140 | * @return void |
| 1081 | 1141 | */ |
| 1082 | -function wpbc_settings_themes__render_calendar_preview( $resource_id, $months_count, $preview_settings = array(), $preview_mode = 'calendar', $custom_booking_form = 'standard' ) { | |
| 1142 | +function wpbc_settings_themes__render_calendar_preview( $resource_id, $months_count, $preview_settings = array(), $preview_mode = 'form', $custom_booking_form = 'standard' ) { | |
| 1083 | 1143 | |
| 1084 | 1144 | global $wpbc_settings_themes__preview_options; |
| 1085 | 1145 | |
| 1086 | 1146 | $resource_id = wpbc_settings_themes__sanitize_preview_resource_id( $resource_id ); |
| @@ -1233,12 +1293,12 @@ | ||
| 1233 | 1293 | 'is_show_top_path' => true, |
| 1234 | 1294 | 'right_vertical_sidebar__is_show' => true, |
| 1235 | 1295 | 'right_vertical_sidebar__default_view_mode' => '', |
| 1236 | 1296 | 'right_vertical_sidebar_compact__is_show' => true, |
| 1237 | - 'left_navigation__default_view_mode' => 'compact', | |
| 1297 | + 'left_navigation__default_view_mode' => '', // FixIn:11.7.1.1: 'compact', | |
| 1238 | 1298 | 'top_path_title' => __( 'Appearance', 'booking' ) . ' / ' . __( 'Theme', 'booking' ), |
| 1239 | - 'title' => __( 'Appearance', 'booking' ) . ' / ' . __( 'Theme', 'booking' ) . | |
| 1240 | - '<span class="wpbc_new_label" style="margin-left: auto;">' . esc_html__( 'New', 'booking' ) . '</span>', | |
| 1299 | + 'title' => __( 'Appearance', 'booking' ) . ' / ' . __( 'Theme', 'booking' ), | |
| 1300 | + // . '<span class="wpbc_new_label" style="margin-left: auto;">' . esc_html__( 'New', 'booking' ) . '</span>' | |
| 1241 | 1301 | 'hint' => __( 'Preview and configure the booking form theme, calendar skin, and time slot appearance.', 'booking' ), |
| 1242 | 1302 | 'page_title' => __( 'Appearance', 'booking' ) . ' / ' . __( 'Theme', 'booking' ), |
| 1243 | 1303 | 'link' => function_exists( 'wpbc_get_settings_themes_url' ) ? wpbc_get_settings_themes_url() : admin_url( 'admin.php?page=wpbc-settings&tab=themes' ), |
| 1244 | 1304 | 'position' => '', |
| @@ -1357,8 +1417,9 @@ | ||
| 1357 | 1417 | $form_style_options = wpbc_settings_themes__get_form_style_options(); |
| 1358 | 1418 | $calendar_skin_options = wpbc_settings_themes__get_calendar_skin_options_for_select(); |
| 1359 | 1419 | $time_skin_options = wpbc_settings_themes__get_time_picker_skin_options(); |
| 1360 | 1420 | $current_form_style = wpbc_bfb_settings__sanitize_form_style( $current_settings['booking_form_style'] ); |
| 1421 | + $current_form_accent = wpbc_bfb_settings__get_form_accent_options( $current_settings ); | |
| 1361 | 1422 | $transition_values = wpbc_settings_themes__map_form_style_to_options( $current_form_style, '' ); |
| 1362 | 1423 | |
| 1363 | 1424 | WPBC_UI_Sidebar_Panels::render_inspector_header( __( 'Appearance', 'booking' ) . ' / ' . __( 'Theme', 'booking' ), __( 'Visual settings for the booking form and calendar preview.', 'booking' ) ); |
| 1364 | 1425 | ?> |
| @@ -1373,9 +1434,9 @@ | ||
| 1373 | 1434 | 'group' => 'settings-theme-form', |
| 1374 | 1435 | 'title' => __( 'Form Style', 'booking' ), |
| 1375 | 1436 | 'open' => true, |
| 1376 | 1437 | ), |
| 1377 | - function () use ( $form_style_options, $current_form_style, $transition_values ) { | |
| 1438 | + function () use ( $form_style_options, $current_form_style, $current_form_accent, $transition_values ) { | |
| 1378 | 1439 | $is_custom = ( 'custom' === (string) $current_form_style ); |
| 1379 | 1440 | $builder_url = add_query_arg( |
| 1380 | 1441 | array( |
| 1381 | 1442 | 'page' => 'wpbc-settings', |
| @@ -1385,11 +1446,40 @@ | ||
| 1385 | 1446 | 'wpbc_bfb_focus' => 'booking_form_custom_background_color', |
| 1386 | 1447 | ), |
| 1387 | 1448 | admin_url( 'admin.php' ) |
| 1388 | 1449 | ); |
| 1450 | + $accent_builder_url = add_query_arg( | |
| 1451 | + array( | |
| 1452 | + 'page' => 'wpbc-settings', | |
| 1453 | + 'tab' => 'builder_booking_form', | |
| 1454 | + 'wpbc_bfb_panel' => 'form_settings', | |
| 1455 | + 'wpbc_bfb_group' => 'settings-appearance', | |
| 1456 | + 'wpbc_bfb_focus' => 'booking_form_accent_apply_to_components', | |
| 1457 | + ), | |
| 1458 | + admin_url( 'admin.php' ) | |
| 1459 | + ); | |
| 1389 | 1460 | ?> |
| 1390 | 1461 | <input type="hidden" id="booking_form_theme" value="<?php echo esc_attr( $transition_values['booking_form_theme'] ); ?>" /> |
| 1391 | 1462 | <input type="hidden" id="booking_form_appearance_preset" value="<?php echo esc_attr( $transition_values['booking_form_appearance_preset'] ); ?>" data-wpbc-theme-appearance-control="1" /> |
| 1463 | + <div class="wpbc_theme_field_row wpbc_theme_accent_toggle_row"> | |
| 1464 | + <label class="wpbc_theme_switch"> | |
| 1465 | + <input type="checkbox" id="booking_form_accent_enabled" name="booking_form_accent_enabled" value="On" <?php checked( 'On', $current_form_accent['booking_form_accent_enabled'] ); ?> data-wpbc-theme-accent-toggle="1" aria-describedby="booking_form_accent_enabled_description" /> | |
| 1466 | + <span class="wpbc_theme_switch_control" aria-hidden="true"><span class="wpbc_theme_switch_knob"></span></span> | |
| 1467 | + <span class="wpbc_theme_switch_label"><?php esc_html_e( 'Custom accent color', 'booking' ); ?></span> | |
| 1468 | + </label> | |
| 1469 | + <p class="wpbc_theme_description" id="booking_form_accent_enabled_description"><?php esc_html_e( 'Use one accent for preset-style primary buttons, secondary-button hover borders, focus, selected choices, and navigation accents. Custom style keeps its explicitly configured button colors. Time slots use it only with the Automatic time-slot style.', 'booking' ); ?></p> | |
| 1470 | + </div> | |
| 1471 | + <div class="wpbc_theme_field_row wpbc_theme_accent_color_row" data-wpbc-theme-accent-color-row="1" data-wpbc-theme-accent-dependent="1" <?php echo ( 'On' === $current_form_accent['booking_form_accent_enabled'] ) ? '' : 'style="display:none;"'; // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped ?>> | |
| 1472 | + <label class="wpbc_theme_field_label" for="booking_form_accent_color"><?php esc_html_e( 'Accent color', 'booking' ); ?></label> | |
| 1473 | + <input type="text" id="booking_form_accent_color" name="booking_form_accent_color" value="<?php echo esc_attr( $current_form_accent['booking_form_accent_color'] ); ?>" class="wpbc_theme_coloris" data-coloris autocomplete="off" pattern="^#[0-9A-Fa-f]{6}$" data-wpbc-theme-appearance-control="1" /> | |
| 1474 | + <p class="wpbc_theme_description"><?php esc_html_e( 'Preset styles calculate readable primary button text and hover colors automatically. Custom style uses its explicit button settings.', 'booking' ); ?></p> | |
| 1475 | + </div> | |
| 1476 | + <div class="wpbc_theme_field_row wpbc_theme_accent_components_row" data-wpbc-theme-accent-dependent="1" <?php echo ( 'On' === $current_form_accent['booking_form_accent_enabled'] ) ? '' : 'style="display:none;"'; // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped ?>> | |
| 1477 | + <a class="button button-secondary" href="<?php echo esc_url( $accent_builder_url ); ?>"> | |
| 1478 | + <?php esc_html_e( 'Apply accent to form elements…', 'booking' ); ?> | |
| 1479 | + </a> | |
| 1480 | + <p class="wpbc_theme_description"><?php esc_html_e( 'Open Forms Builder to copy the accent into editable component colors and switch time slots to Automatic — Match Booking Form.', 'booking' ); ?></p> | |
| 1481 | + </div> | |
| 1392 | 1482 | <div class="wpbc_theme_choice_grid wpbc_theme_style_choice_grid"> |
| 1393 | 1483 | <?php foreach ( $form_style_options as $style_value => $style_title ) : ?> |
| 1394 | 1484 | <label class="wpbc_theme_choice <?php echo ( (string) $current_form_style === (string) $style_value ) ? 'is-selected' : ''; ?>"> |
| 1395 | 1485 | <input type="radio" name="booking_form_style" value="<?php echo esc_attr( $style_value ); ?>" <?php checked( (string) $current_form_style, (string) $style_value ); ?> /> |
| @@ -1476,9 +1566,9 @@ | ||
| 1476 | 1566 | ), |
| 1477 | 1567 | function () use ( $time_skin_options, $current_settings ) { |
| 1478 | 1568 | ?> |
| 1479 | 1569 | <div class="wpbc_theme_field_row"> |
| 1480 | - <label class="wpbc_theme_field_label" for="booking_timeslot_picker_skin"><?php esc_html_e( 'Time Picker Skin', 'booking' ); ?></label> | |
| 1570 | + <label class="wpbc_theme_field_label" for="booking_timeslot_picker_skin"><?php esc_html_e( 'Time Slot Style', 'booking' ); ?></label> | |
| 1481 | 1571 | <?php |
| 1482 | 1572 | wpbc_settings_themes__render_select( |
| 1483 | 1573 | 'booking_timeslot_picker_skin', |
| 1484 | 1574 | $time_skin_options, |
| @@ -1491,8 +1581,9 @@ | ||
| 1491 | 1581 | ), |
| 1492 | 1582 | ) |
| 1493 | 1583 | ); |
| 1494 | 1584 | ?> |
| 1585 | + <p class="description"><?php esc_html_e( 'Automatic matches time slots to the active Booking Form Style and accent color. Existing skins remain available for fixed color schemes.', 'booking' ); ?></p> | |
| 1495 | 1586 | </div> |
| 1496 | 1587 | <label class="wpbc_theme_switch wpbc_theme_switch_card"> |
| 1497 | 1588 | <input type="checkbox" name="booking_timeslot_picker" value="On" data-wpbc-theme-preview-notice="form" <?php checked( $current_settings['booking_timeslot_picker'], 'On' ); ?> /> |
| 1498 | 1589 | <span class="wpbc_theme_switch_control" aria-hidden="true"><span class="wpbc_theme_switch_knob"></span></span> |