'subtab', // Required| Possible values: 'subtab' | 'separator' | 'button' | 'goto-link' | 'html'. 'title' => '', // Example: __( 'Dashboard' // Title of TAB. 'page_title' => '', // __( 'Search Availability' // Title of Page. 'hint' => '', // __( 'Configure the layout and functionality of both the search form and search results.' // Hint. 'link' => '', // wpbc_get_settings_url() . '&scroll_to_section=wpbc_general_settings_dashboard_tab', // Link. 'css_classes' => '', // cls CSS . 'font_icon' => 'wpbc_icn_dashboard', 'font_icon_right' => 'wpbc-bi-question-circle', // 'wpbc-bi-question-circle' . 'default' => false, // Is this sub tab activated by default or not: true || false. ); $tabs[ 'form' ] = array( 'is_show_top_path' => false, // true | false. By default value is: false. 'left_navigation__default_view_mode' => 'compact', // '' | 'min' | 'compact' | 'max' | 'none'. By default value is: ''. 'page_title' => __( 'Booking Form', 'booking'), // Header - Title. If false, than hidden. 'page_description' => __('Add, remove, or customize fields in your booking form.','booking'), // Header - Title Description. If false, than hidden. 'title' => __( 'Booking Form', 'booking') // Title of TAB , 'page_title'=> __( 'Booking Form', 'booking') // Title of Page , 'hint' => __( 'Add, remove, or customize fields in your booking form.', 'booking') // Hint //, 'css_classes'=> '' // CSS class(es) , 'font_icon' => 'wpbc_icn_dashboard _customize dashboard rtt draw' // CSS definition of forn Icon , 'default' => false // Is this tab activated by default or not: true || false. , 'subtabs' => array() , 'folder_style' => 'order:10;', ); $section_id = 'wpbc_general_settings_booking_form_fields_metabox'; $subtabs['booking_form_fields'] = array_merge( $subtab_default, array( 'title' => __( 'Booking Form Fields', 'booking' ), 'page_title' => __( 'Booking Form Fields', 'booking' ), 'hint' => __( 'Add, remove, or customize fields in your booking form.', 'booking' ), 'font_icon' => 'wpbc-bi-ui-radios', 'font_icon_right' => 'wpbc-bi-question-circle', 'css_classes' => 'do_expand__' . $section_id . '_link', // sub_bold', . //'onclick' => "wpbc_admin_ui__do__open_url__expand_section( '" . wpbc_get_settings_url() . "', '" . $section_id . "' );", 'link' => wpbc_get_settings_url() . '&tab=form', 'default' => true, ) ); $tabs[ 'form' ]['subtabs'] = $subtabs; if ( ! class_exists( 'wpdev_bk_personal' ) ) // FixIn: 8.1.1.12. $tabs[ 'upgrade-link' ] = array( 'title' => __('Free vs Pro','booking') // Title of TAB , 'hint' => __('Upgrade to higher versions', 'booking') // Hint //, 'page_title' => __('Upgrade', 'booking') // Title of Page , 'link' => 'https://wpbookingcalendar.com/features/' // Can be skiped, then generated link based on Page and Tab tags. Or can be extenral link , 'position' => 'right' // 'left' || 'right' || '' //, 'css_classes' => '' // CSS class(es) //, 'icon' => '' // Icon - link to the real PNG img , 'font_icon' => 'wpbc_icn_redeem'// CSS definition of forn Icon //, 'default' => false // Is this tab activated by default or not: true || false. //, 'subtabs' => array() , 'folder_style' => 'order:9999;' ); return $tabs; } public function content() { $this->css(); // Define Notices Section and show some static messages, if needed do_action( 'wpbc_hook_settings_page_header', 'form_field_free_settings'); if ( ! wpbc_is_mu_user_can_be_here('activated_user') ) return false; // Check if MU user activated, otherwise show Warning message. //if ( ! wpbc_is_mu_user_can_be_here('only_super_admin') ) return false; // User is not Super admin, so exit. Basically its was already checked at the bottom of the PHP file, just in case. // ------------------------------------------------------------------------------------------------------------- // Submit // ------------------------------------------------------------------------------------------------------------- $submit_form_name = 'wpbc_form_field_free'; // Define form name // phpcs:ignore WordPress.Security.NonceVerification.Recommended, WordPress.Security.NonceVerification.Missing if ( isset( $_POST[ 'is_form_sbmitted_' . $submit_form_name ] ) ) { // Nonce checking {Return false if invalid, 1 if generated between, 0-12 hours ago, 2 if generated between 12-24 hours ago. } $nonce_gen_time = check_admin_referer( 'wpbc_settings_page_' . $submit_form_name ); // Its stop show anything on submitting, if it's not refear to the original page wpbc_simple_form__page_save_submit(); // Save Changes } echo ''; wpbc_js_for_bookings_page(); // JavaScript: Tooltips, Popover, Datepick (js & css) ////////////////// echo ''; // ------------------------------------------------------------------------------------------------------------- // Content // ------------------------------------------------------------------------------------------------------------- ?>
left_navigation_menu_template(); ?>
content_section__form_fields(); ?>
false, 'is_show_minimize' => false, 'css_class'=>'postbox wpbc_container_hide__on_left_nav_click' ) ); $this->content_section__form_layout(); wpbc_close_meta_box_section(); $is_can = apply_bk_filter( 'multiuser_is_user_can_be_here', true, 'only_super_admin' ); if ( $is_can ) { wpbc_open_meta_box_section( 'wpbc_settings__form_theme', __('Color Theme', 'booking'), array( 'is_section_visible_after_load' => false, 'is_show_minimize' => false, 'css_class'=>'postbox wpbc_container_hide__on_left_nav_click' ) ); $this->content_section__form_color_theme(); ?>
content_section__calendar_skin(); $this->content_section__time_picker_skin(); ?>
false, 'is_show_minimize' => false, 'css_class'=>'postbox wpbc_container_hide__on_left_nav_click' ) ); $this->content_section__form_options(); wpbc_close_meta_box_section(); } ?>
show_booking_form_fields_table( $booking_form_structure ); ?>
array( 'optgroup' => true , 'close' => false , 'title' => ' ' . __('Standard Forms' ,'booking') ) // FixIn: 10.7.1.7. , 'wizard_2columns' => array( 'title' => __('Wizard (several steps)', 'booking') , 'id' => '' , 'name' => '' , 'style' => '' , 'class' => '' , 'disabled' => false , 'selected' => false , 'attr' => array() ) , 'wizard_services_a' => array( 'title' => __( 'Wizard (Steps Timline)', 'booking' ) , 'id' => '' , 'name' => '' , 'style' => '' , 'class' => '' , 'disabled' => false , 'selected' => false , 'attr' => array() ) , 'vertical' => array( 'title' => __('Form under calendar', 'booking') , 'id' => '' , 'name' => '' , 'style' => '' , 'class' => '' , 'disabled' => false , 'selected' => false , 'attr' => array() ) , 'form_right' => array( 'title' => __('Form at right side of calendar', 'booking') , 'id' => '' , 'name' => '' , 'style' => '' , 'class' => '' , 'disabled' => false , 'selected' => false , 'attr' => array() ) , 'form_center' => array( 'title' => __('Form and calendar are centered', 'booking') , 'id' => '' , 'name' => '' , 'style' => '' , 'class' => '' , 'disabled' => false , 'selected' => false , 'attr' => array() ) , 'optgroup_sf_e' => array( 'optgroup' => true, 'close' => true ) // , 'optgroup_help_tips_s' => array( // 'optgroup' => true // , 'close' => false // , 'title' => ' ' . __('Advanced Forms' ,'booking') // ) // , 'form_2_columns' => array( // 'title' => __('2 Columns', 'booking') // , 'id' => '' // , 'name' => '' // , 'style' => '' // , 'class' => '' // , 'disabled' => true // , 'selected' => false // , 'attr' => array() // ) // , 'optgroup_help_tips_e' => array( 'optgroup' => true, 'close' => true ) ); WPBC_Settings_API::field_select_row_static( 'booking_form_structure_type__select' , array( 'type' => 'select' , 'title' => __('Form Layout', 'booking') , 'label' => '' , 'disabled' => false , 'disabled_options' => array() , 'multiple' => false , 'description' => '' , 'description_tag' => 'span' , 'group' => 'form_layout' , 'tr_class' => '' , 'class' => '' , 'css' => 'width:auto;max-width:100%;' , 'only_field' => false , 'attr' => array() , 'value' => $field_value_or_default , 'options' => $field_options , 'attr' => array( 'onchange' => "javascript: if( 'wizard_2columns' === jQuery( this ).val() ) { jQuery( '#booking_form_layout_width' ).val( '100' ); jQuery( '#booking_form_layout_width_px_pr' ).val( '%' ); jQuery( '#booking_form_layout_max_cols' ).val( '2' ); } " . " if( 'wizard_services_a' === jQuery( this ).val() ) { jQuery( '#booking_form_layout_width' ).val( '100' ); jQuery( '#booking_form_layout_width_px_pr' ).val( '%' ); jQuery( '#booking_form_layout_max_cols' ).val( '2' ); } " . " if( 'vertical' === jQuery( this ).val() ) { jQuery( '#booking_form_layout_max_cols' ).val( '2' ); jQuery( '#booking_form_layout_width' ).val( '100' ); jQuery( '#booking_form_layout_width_px_pr' ).val( '%' ); } " . " if( 'form_right' === jQuery( this ).val() ) { jQuery( '#booking_form_layout_max_cols' ).val( '1' ); jQuery( '#booking_form_layout_width' ).val( '440' ); jQuery( '#booking_form_layout_width_px_pr' ).val( 'px' ); } " . " if( 'form_center' === jQuery( this ).val() ) { jQuery( '#booking_form_layout_max_cols' ).val( '1' ); jQuery( '#booking_form_layout_width' ).val( '440' ); jQuery( '#booking_form_layout_width_px_pr' ).val( 'px' ); } " ) ) ); $field_value_or_default = ( empty( get_bk_option( 'booking_form_layout_max_cols' ) ) ? $default_options_values['booking_form_layout_max_cols'] : get_bk_option( 'booking_form_layout_max_cols' ) ); WPBC_Settings_API::field_select_row_static( 'booking_form_layout_max_cols' , array( 'type' => 'select' , 'title' => __( 'Columns', 'booking' ) , 'label' => '' , 'disabled' => false , 'disabled_options' => array() , 'multiple' => false , 'description' => __('Set number of columns in booking form','booking') , 'description_tag' => 'span' , 'group' => 'form_layout' , 'tr_class' => '' , 'class' => '' , 'css' => 'width:auto;max-width:100%;' , 'only_field' => false , 'attr' => array() , 'value' => $field_value_or_default , 'options' => array( 1 => 1, 2 => 2, 3 => 3 ) //, 'attr' => array( 'onchange' => "javascript: if( 'wizard_2columns' === jQuery( this ).val() ) { jQuery( '#booking_form_layout_width' ).val( '100' ); jQuery( '#booking_form_layout_width_px_pr' ).find( 'option' ).prop( 'selected', false ); jQuery( '#booking_form_layout_width_px_pr' ).val( '%' ); } " ) ) ); $id = 'booking_form_layout'; ?>
'text' , 'placeholder' => '100' , 'class' => '' , 'css' => 'width:5em;' , 'only_field' => true , 'attr' => array() , 'value' => ( empty( get_bk_option( $field_name ) ) ? $default_options_values[ $field_name ] : get_bk_option( $field_name ) ) ) ); $field_name = $id . '_width_px_pr'; // % WPBC_Settings_API::field_select_row_static( $field_name , array( 'type' => 'select' , 'multiple' => false , 'class' => '' , 'css' => 'width:4em;' , 'only_field' => true , 'attr' => array() , 'options' => array( 'px' => 'px', '%' => '%' ) , 'value' => ( empty( get_bk_option( $field_name ) ) ? $default_options_values[ $field_name ] : get_bk_option( $field_name ) ) ) ); ?>
'select' , 'default' => $default_options_values[ $field_name ] //'Off' , 'title' => __('Color Theme' ,'booking') , 'description' => __('Select a color theme for your booking form that matches the look of your website.' ,'booking') // . '
' // . __('When you select a color theme, it also change the calendar and time-slot picker skins to match your choice. Customize these options separately as needed.' ,'booking') // .'
' , 'options' => array( '' => __( 'Light', 'booking' ), 'wpbc_theme_dark_1' => __( 'Dark', 'booking' ) ) , 'group' => 'form' , 'value' => ( empty( get_bk_option( $field_name ) ) ? $default_options_values[ $field_name ] : get_bk_option( $field_name ) ), 'attr' => array( 'onchange' => "javascript: wpbc_on_change__form_color_theme( this );" ) ); WPBC_Settings_API::field_select_row_static( $field_name, $field_params ); ?>
'checkbox' , 'default' => $default_options_values[ $field_name ] //'Off' , 'title' => __('Auto-fill fields' ,'booking') , 'label' => __('Check the box to activate auto-fill form fields for logged in users.' ,'booking') , 'description' => '' , 'group' => 'form' , 'value' => ( empty( get_bk_option( $field_name ) ) ? $default_options_values[ $field_name ] : get_bk_option( $field_name ) ) ); WPBC_Settings_API::field_checkbox_row_static( $field_name, $field_params ); $field_name = 'booking_timeslot_picker'; $field_params = array( 'type' => 'checkbox' , 'default' => $default_options_values[ $field_name ] //'Off' , 'title' => __('Time picker for time slots' ,'booking') , 'label' => __('Show time slots as a time picker instead of a select box.' ,'booking') , 'description' => '' , 'group' => 'time_slots' , 'tr_class' => 'wpbc_timeslot_picker' , 'value' => ( empty( get_bk_option( $field_name ) ) ? $default_options_values[ $field_name ] : get_bk_option( $field_name ) ) ); WPBC_Settings_API::field_checkbox_row_static( $field_name, $field_params ); ?>
:
'; esc_html_e( 'Error', 'booking' ); echo '!  '; /* translators: 1: ... */ echo wp_kses_post( __( 'You can either use the time slots field or the start time and duration time fields, but not both. If you choose to use the start time and duration time fields, make sure to use them together.', 'booking' ) ); ?>
'; esc_html_e( 'Error', 'booking' ); echo '!  '; /* translators: 1: ... */ echo wp_kses_post( __( 'You must use both the start time field and the duration time field together.', 'booking' ) ); ?>
1 ) { return 'duplicated_time_fields'; } } else { if ( count( $time_fields_arr ) === 1 ) { return 'missed_time_fields'; } } return 'ok'; } /** * Show Fields Table */ private function show_booking_form_fields_table( $booking_form_structure ) { $booking_form_structure = maybe_unserialize( $booking_form_structure ); $skip_obligatory_field_types =array();// array( 'calendar', 'submit', 'captcha' ); $obligatory_field_types = array( 'calendar', 'submit', 'email' ); if ( ! wpbc_is_mu_user_can_be_here( 'only_super_admin' ) ) { $obligatory_field_types[] = 'captcha'; } if ( 'duplicated_time_fields' === $this->is_exist_duplicated_time_fields( $booking_form_structure ) ) { $this->help_notice__show_time_fields_once(); } if ( 'missed_time_fields' === $this->is_exist_duplicated_time_fields( $booking_form_structure ) ) { $this->help_notice__show_missed_time_fields(); } ?> ?> 'text' , 'name' => 'unique_name' , 'obligatory' => 'Off' , 'active' => 'On' , 'required' => 'Off' , 'label' => '' , 'value' => '' ); $form_field = wp_parse_args( $form_field, $defaults ); if( ! in_array( $form_field['type'], $skip_obligatory_field_types ) ) { $i++; $row = ''; $row .= ''; // Flex Toggle if ( 1 ) { ob_start(); $is_checked = ( $form_field['active'] === 'On' ); $field_id = 'wpbc_on_off_' . 'active_' . intval( microtime( true ) ) . '_' . wp_rand( 1, 1000 ); $field_name = 'form_field_active[' . $i . ']'; $field_value = esc_attr( $form_field['active'] ); $params_checkbox = array( 'id' => $field_id // HTML ID of element , 'name' => $field_name , 'label' => array( 'title' => '', 'position' => 'right' ) , 'toggle_style' => '' // CSS of select element , 'class' => 'wpbc_visible_but_out_screen ' // CSS Class of select element , 'disabled' => '' , 'attr' => array( 'autocomplete' => 'off' ) // Any additional attributes, if this radio | checkbox element , 'legend' => '' //wp_kses_post( $field_title ) // aria-label parameter , 'value' => $field_value // Some Value from options array that selected by default , 'selected' => $is_checked // Selected or not //, 'onchange' => "jQuery( this ).parents('.wpbc_searchable_on_off').find('.wpbc_label_on_off').hide();jQuery( this ).parents('.wpbc_searchable_on_off').find( jQuery( this ).is(':checked') ? '.wpbc_label_on' : '.wpbc_label_off' ).show();" // JavaScript code //, 'onfocus' => "console.log( 'ON FOCUS:', jQuery( this ).is(':checked') , 'in element:' , jQuery( this ) );" // JavaScript code //, 'hint' => array( 'title' => __('Send email notification to customer about this operation' ,'booking') , 'position' => 'top' ) ); wpbc_flex_toggle( $params_checkbox ); $flex_toggle = ob_get_clean(); } $row .= ''; $row .= ''; //FixIn: TimeFreeGenerator $is_show_required_checkbox = true; if ( ( $form_field['obligatory'] == 'On' ) || ( in_array( $form_field['type'], $obligatory_field_types ) ) ) { $is_show_required_checkbox = false; } if ( isset( $form_field['if_exist_required'] ) && ( $form_field['if_exist_required'] == 'On' ) ) { $is_show_required_checkbox = false; } // Flex Toggle if ( 1 ) { ob_start(); $is_checked = ( $form_field['required'] === 'On' ); $field_id = 'wpbc_on_off_' . 'required_' . intval( microtime( true ) ) . '_' . wp_rand( 1, 1000 ); $field_name = 'form_field_required[' . $i . ']'; $field_value = esc_attr( $form_field['required'] ); $params_checkbox = array( 'id' => $field_id // HTML ID of element , 'name' => $field_name , 'label' => array( 'title' => '', 'position' => 'right' ) , 'toggle_style' => '' // CSS of select element , 'class' => 'wpbc_visible_but_out_screen ' // CSS Class of select element , 'disabled' => '' , 'attr' => array( 'autocomplete' => 'off' ) // Any additional attributes, if this radio | checkbox element , 'legend' => '' //wp_kses_post( $field_title ) // aria-label parameter , 'value' => $field_value // Some Value from options array that selected by default , 'selected' => $is_checked // Selected or not //, 'onchange' => "jQuery( this ).parents('.wpbc_searchable_on_off').find('.wpbc_label_on_off').hide();jQuery( this ).parents('.wpbc_searchable_on_off').find( jQuery( this ).is(':checked') ? '.wpbc_label_on' : '.wpbc_label_off' ).show();" // JavaScript code //, 'onfocus' => "console.log( 'ON FOCUS:', jQuery( this ).is(':checked') , 'in element:' , jQuery( this ) );" // JavaScript code //, 'hint' => array( 'title' => __('Send email notification to customer about this operation' ,'booking') , 'position' => 'top' ) ); wpbc_flex_toggle( $params_checkbox ); $flex_toggle = ob_get_clean(); } $row .= ''; // $row .= ''; $row .= ''; // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped echo $row; } } ?>
' . esc_html__('Shortcodes' ,'booking') . '. ' . wp_kses_post( sprintf(__('You can generate the form fields for your form (at the left side) by selection specific field in the above selectbox.' ,'booking'),'[email* email]')) /* translators: 1: ... */ .'
' . wp_kses_post( sprintf( __( 'Please read more about the booking form fields configuration %1$shere%2$s.', 'booking' ),'', '') ) . '

' . esc_html__('Default Form Templates' ,'booking') . '. ' . /* translators: 1: ... */ wp_kses_post( sprintf( __( 'You can reset your active form template by selecting default %1$sform template%2$s at the top toolbar. Please select the form template and click on %3$sReset%4$s button for resetting only active form (Booking Form or Content of Booking Fields form). Click on %5$sBoth%6$s button if you want to reset both forms: Booking Form and Content of Booking Fields form.', 'booking' ) ,'','' ,'','' ,'','' ) ) .'

'; ?>
generate_field( 'text_field_generator' , array( 'active' => true , 'required' => true , 'label' => true , 'name' => true , 'value' => false , 'type' => 'text' ) ); ?>
generate_field( 'textarea_field_generator' , array( 'active' => true , 'required' => true , 'label' => true , 'name' => true , 'value' => false , 'type' => 'textarea' ) ); ?>
generate_field( 'selectbox_field_generator' , array( 'active' => true , 'required' => true , 'label' => true , 'name' => true , 'value' => true , 'type' => 'selectbox' ) ); ?>
generate_field( 'checkbox_field_generator' , array( 'active' => true , 'required' => true , 'label' => true , 'name' => true , 'value' => false , 'type' => 'checkbox' ) ); ?>
generate_field( 'rangetime_field_generator' , array( 'active' => true , 'required' => true , 'label' => true , 'name' => true , 'value' => true , 'type' => 'selectbox' , 'required_attr' => array( 'disabled' => true , 'value' => 'On' ) , 'label_attr' => array( 'placeholder' => __( 'Time Slots', 'booking' ) , 'value' => __( 'Time Slots', 'booking' ) ) , 'name_attr' => array( 'disabled' => true , 'placeholder' => 'rangetime' , 'value' => 'rangetime' ) , 'value_attr' => array( 'value' => "10:00 AM - 12:00 PM@@10:00 - 12:00\n12:00 PM - 02:00 PM@@12:00 - 14:00\n13:00 - 14:00\n11:00 - 15:00\n14:00 - 16:00\n16:00 - 18:00\n18:00 - 20:00" , 'attr' => array( 'placeholder' => "10:00 AM - 12:00 PM@@10:00 - 12:00\n12:00 PM - 02:00 PM@@12:00 - 14:00\n13:00 - 14:00\n11:00 - 15:00\n14:00 - 16:00\n16:00 - 18:00\n18:00 - 20:00" ) , 'rows' => 8 , 'cols' => 37 ) ) ); ?>
generate_field( 'durationtime_field_generator', array( 'active' => true, 'required' => true, 'label' => true, 'name' => true, 'value' => true, 'type' => 'selectbox', 'required_attr' => array( 'disabled' => true, 'value' => 'On', ), 'label_attr' => array( 'placeholder' => __( 'Duration Time', 'booking' ), 'value' => __( 'Duration Time', 'booking' ), ), 'name_attr' => array( 'disabled' => true, 'placeholder' => 'durationtime', 'value' => 'durationtime', ), 'value_attr' => array( 'value' => "Service A (15 min)@@00:15\nService B (20 min)@@00:20\nService C (30 min)@@00:30\nService D (1 hour)@@01:00\nService E (2 hours)@@02:00", 'attr' => array( 'placeholder' => "Service A (15 min)@@00:15\nService B (20 min)@@00:20\nService C (30 min)@@00:30\nService D (1 hour)@@01:00\nService E (2 hours)@@02:00", ), 'rows' => 8, 'cols' => 37, ), ) ); ?>
generate_field( 'starttime_field_generator', array( 'active' => true, 'required' => true, 'label' => true, 'name' => true, 'value' => true, 'type' => 'selectbox', 'required_attr' => array( 'disabled' => true, 'value' => 'On', ), 'label_attr' => array( 'placeholder' => __( 'Start Time', 'booking' ), 'value' => __( 'Start Time', 'booking' ), ), 'name_attr' => array( 'disabled' => true, 'placeholder' => 'starttime', 'value' => 'starttime', ), 'value_attr' => array( 'value' => "10:00 AM@@10:00\n10:30 AM@@10:30\n11:00 AM@@11:00\n11:30 AM@@11:30\n12:00 PM@@12:00\n12:30 PM@@12:30\n1:00 PM@@13:00\n1:30 PM@@13:30\n2:00 PM@@14:00\n2:30 PM@@14:30\n3:00 PM@@15:00\n3:30 PM@@15:30\n4:00 PM@@16:00\n4:30 PM@@16:30\n5:00 PM@@17:00\n5:30 PM@@17:30\n6:00 PM@@18:00", 'attr' => array( 'placeholder' => "10:00 AM@@10:00\n10:30 AM@@10:30\n11:00 AM@@11:00\n11:30 AM@@11:30\n12:00 PM@@12:00\n12:30 PM@@12:30\n1:00 PM@@13:00\n1:30 PM@@13:30\n2:00 PM@@14:00\n2:30 PM@@14:30\n3:00 PM@@15:00\n3:30 PM@@15:30\n4:00 PM@@16:00\n4:30 PM@@16:30\n5:00 PM@@17:00\n5:30 PM@@17:30\n6:00 PM@@18:00", ), 'rows' => 8, 'cols' => 37, ), ) ); ?>
generate_field( 'endtime_field_generator', array( 'active' => true, 'required' => true, 'label' => true, 'name' => true, 'value' => true, 'type' => 'selectbox', 'required_attr' => array( 'disabled' => true, 'value' => 'On', ), 'label_attr' => array( 'placeholder' => __( 'End Time', 'booking' ), 'value' => __( 'End Time', 'booking' ), ), 'name_attr' => array( 'disabled' => true, 'placeholder' => 'endtime', 'value' => 'endtime', ), 'value_attr' => array( 'value' => "10:00 AM@@10:00\n10:30 AM@@10:30\n11:00 AM@@11:00\n11:30 AM@@11:30\n12:00 PM@@12:00\n12:30 PM@@12:30\n1:00 PM@@13:00\n1:30 PM@@13:30\n2:00 PM@@14:00\n2:30 PM@@14:30\n3:00 PM@@15:00\n3:30 PM@@15:30\n4:00 PM@@16:00\n4:30 PM@@16:30\n5:00 PM@@17:00\n5:30 PM@@17:30\n6:00 PM@@18:00", 'attr' => array( 'placeholder' => "10:00 AM@@10:00\n10:30 AM@@10:30\n11:00 AM@@11:00\n11:30 AM@@11:30\n12:00 PM@@12:00\n12:30 PM@@12:30\n1:00 PM@@13:00\n1:30 PM@@13:30\n2:00 PM@@14:00\n2:30 PM@@14:30\n3:00 PM@@15:00\n3:30 PM@@15:30\n4:00 PM@@16:00\n4:30 PM@@16:30\n5:00 PM@@17:00\n5:30 PM@@17:30\n6:00 PM@@18:00", ), 'rows' => 8, 'cols' => 37, ), ) ); ?>
 
true , 'required' => true , 'label' => true , 'name' => true , 'value' => true //FixIn: TimeFreeGenerator (inside of form fields edited, as well) , 'required_attr' => array( 'disabled' => false , 'value' => 'Off' ) , 'label_attr' => array( 'placeholder' => __('First Name', 'booking') , 'value' => '' ) , 'name_attr' => array( 'disabled' => false , 'placeholder' => 'first_name' , 'value' => '' ) , 'value_attr' => array( 'value' => '' , 'attr' => array( 'placeholder' => "1\n2\n3\n4" ) , 'rows' => 8 , 'cols' => 37 ) ); $field_options = wp_parse_args( $field_options, $defaults ); ?> 'checkbox' , 'title' => __('Active', 'booking') , 'label' => __('Show / hide field in booking form', 'booking') , 'disabled' => false , 'class' => '' , 'css' => '' , 'type' => 'checkbox' , 'description' => '' , 'attr' => array() , 'group' => 'general' , 'tr_class' => '' , 'only_field' => false , 'is_new_line' => true , 'description_tag' => 'span' , 'value' => 'On' ) , true ); if ( $field_options['required'] ) WPBC_Settings_API::field_checkbox_row_static( $field_name . '_required' , array( 'type' => 'checkbox' , 'title' => __('Required', 'booking') , 'label' => __('Set field as required', 'booking') , 'disabled' => $field_options[ 'required_attr' ][ 'disabled' ] //false , 'class' => '' , 'css' => '' , 'type' => 'checkbox' , 'description' => '' , 'attr' => array() , 'group' => 'general' , 'tr_class' => '' , 'only_field' => false , 'is_new_line' => true , 'description_tag' => 'span' , 'value' => $field_options[ 'required_attr' ][ 'value' ] //'Off' ) , true ); if ( $field_options['label'] ) WPBC_Settings_API::field_text_row_static( $field_name . '_label' , array( 'type' => 'text' , 'title' => __('Label', 'booking') , 'disabled' => false , 'class' => '' , 'css' => '' , 'placeholder' => $field_options[ 'label_attr' ][ 'placeholder' ] //'First Name' , 'description' => ''//__('Enter field label', 'booking') , 'group' => 'general' , 'tr_class' => '' , 'only_field' => false , 'description_tag' => 'p' , 'value' => $field_options[ 'label_attr' ][ 'value' ] //'' , 'attr' => array( 'oninput' => "javascript:this.onchange();" , 'onpaste' => "javascript:this.onchange();" , 'onkeypress'=> "javascript:this.onchange();" , 'onchange' => "javascript:if ( ! jQuery('#".$field_name . '_name'."').is(':disabled') ) { jQuery('#".$field_name . '_name'."').val(jQuery(this).val() );} wpbc_check_typed_name('".$field_name."');" ) ) , true ); if ( $field_options['name'] ) WPBC_Settings_API::field_text_row_static( $field_name . '_name' , array( 'type' => 'text' , 'title' => __('Name', 'booking') . ' *' , 'disabled' => $field_options[ 'name_attr' ][ 'disabled' ] //false , 'class' => '' , 'css' => '' , 'placeholder' => $field_options[ 'name_attr' ][ 'placeholder' ] //'first_name' /* translators: 1: ... */ , 'description' => sprintf( __( 'Type only %1$sunique field name%2$s, that is not using in form', 'booking' ), '', '' ) , 'group' => 'general' , 'tr_class' => '' , 'only_field' => false , 'description_tag' => 'p' , 'value' => $field_options[ 'name_attr' ][ 'value' ] //'' , 'attr' => array( 'oninput' => "javascript:this.onchange();" , 'onpaste' => "javascript:this.onchange();" , 'onkeypress'=> "javascript:this.onchange();" , 'onchange' => "javascript:wpbc_check_typed_name('".$field_name."');" ) ) , true ); if ( $field_options['value'] ) WPBC_Settings_API::field_textarea_row_static( $field_name . '_value' , array( 'title' => __('Values', 'booking') , 'disabled' => false , 'class' => '' , 'css' => '' , 'placeholder' => '' , 'description' => __('Enter dropdown options. One option per line.', 'booking') //. '
' //. (( 'durationtime_field_generator' !== $field_options['name'] ) ? '' : __( 'The option format is "Title@@Time Duration," where "Title" is usually the service name and "Time Duration" is defined in the format HH:MM (HH = hours from 00 to 23, MM = minutes from 00 to 59).', 'booking' )) //. (( 'starttime_field_generator' !== $field_options['name'] ) ? '' : __( 'The option format is "Title@@Time," where "Title" is any text (typically the time in AM/PM format) and "Time" is defined in the 24-hour format (HH:MM), where HH = hours (00 to 23) and MM = minutes (00 to 59).', 'booking' )) , 'group' => 'general' , 'tr_class' => '' , 'only_field' => false , 'description_tag' => 'p' , 'value' => $field_options[ 'value_attr' ][ 'value' ] // '' , 'attr' => $field_options[ 'value_attr' ][ 'attr' ] //array( 'placeholder' => "1\n2\n3\n4" ) //Override Placeholder value, because of escaping \n symbols , 'rows' => $field_options[ 'value_attr' ][ 'rows' ] //2 , 'cols' => $field_options[ 'value_attr' ][ 'cols' ] //37 , 'show_in_2_cols' => false , 'attr' => array( 'oninput' => "javascript:this.onchange();" , 'onpaste' => "javascript:this.onchange();" , 'onkeypress'=> "javascript:this.onchange();" , 'onchange' => "javascript:wpbc_check_typed_values('".$field_name."');" ) ) , true ); do_action( 'wpbc_settings_form_page_after_values', $field_name, $field_options ); //FixIn: TimeFreeGenerator ?>
        
        
public function activate() { add_bk_option( 'booking_form', wpbc_simple_form__get_booking_form__as_shortcodes() ); add_bk_option( 'booking_form_show', wpbc_simple_form__get_form_show__as_shortcodes() ); add_bk_option( 'booking_form_visual', wpbc_simple_form__visual__get_default_form() ); } public function deactivate() { delete_bk_option( 'booking_form' ); delete_bk_option( 'booking_form_show' ); delete_bk_option( 'booking_form_visual'); } // } add_action('wpbc_menu_created', array( new WPBC_Page_SettingsFormFieldsFree() , '__construct') ); // Executed after creation of Menu // ===================================================================================================================== // Load JS files at specific pages only // ===================================================================================================================== /** * Load JS files. * * @param $hook 'post.php' | 'wp-booking-calendar3_page_wpbc-resources' * * @return void */ function wpbc_register_js__page_form_simple( $hook ) { if ( ( isset( $_REQUEST['page'] ) ) && ( 'wpbc-settings' === $_REQUEST['page'] ) // phpcs:ignore WordPress.Security.NonceVerification.Recommended, WordPress.Security.NonceVerification.Missing && ( isset( $_REQUEST['tab'] ) ) && ( 'form' === $_REQUEST['tab'] ) // phpcs:ignore WordPress.Security.NonceVerification.Recommended, WordPress.Security.NonceVerification.Missing ) { // wpbc_load_js__required_for_modals(); // wpbc_load_js__required_for_media_upload(); wp_enqueue_script( 'wpbc_simple_form', wpbc_plugin_url( '/includes/page-form-simple/_src/wpbc_simple_form.js' ), array( 'wpbc_all' ), WP_BK_VERSION_NUM, array( 'in_footer' => WPBC_JS_IN_FOOTER ) ); } } add_action( 'admin_enqueue_scripts', 'wpbc_register_js__page_form_simple' );