PluginProbe
Booking Calendar / 11.7
Booking Calendar v11.7
11.8.4 11.8.3 11.8.2 11.8.1 11.8 11.7 11.6.1 11.6 11.5 11.4.3 11.4.2 11.4.1 11.4 11.3 11.2.1 11.2 11.1 11.0 10.15.7 10.15.6 10.1.3 10.10 10.10.1 10.10.2 10.11 All 204 releases
booking / includes / page-form-builder / form-details / current-form-details.php

current-form-details.php in Booking Calendar 11.7, at includes/page-form-builder/form-details/current-form-details.php

192 lines 6.9 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2 /**
3 * BFB Current Form Details UI.
4 *
5 * Renders UI controls for the currently loaded form:
6 * - Slug / Key
7 * - Title
8 * - Picture (via WP Media picker in JS)
9 * - Description
10 *
11 * Notes:
12 * - Controls are "ui" scope (rendered in UI), but values are persisted per-form by JS
13 * that injects `form_details` into the "Save Form" AJAX payload.
14 *
15 * @package Booking Calendar
16 * @subpackage Form Builder
17 * @since 11.0.x
18 * @file includes/page-form-builder/form-details/current-form-details.php
19 */
20
21 if ( ! defined( 'ABSPATH' ) ) {
22 exit;
23 }
24
25 /**
26 * Print Current Form Details groups and controls.
27 *
28 * @return void
29 */
30 function wpbc_bfb_ui__current_form_details__print() {
31
32 $panel_id_basic = 'wpbc_bfb_form_details_panel_basic';
33
34 ?>
35 <section class="wpbc_bfb__inspector__group wpbc_ui__collapsible_group is-open" data-group="form-details-basic">
36 <button type="button" class="group__header" role="button" aria-expanded="true" aria-controls="<?php echo esc_attr( $panel_id_basic ); ?>">
37 <h3><?php esc_html_e( 'Basic', 'booking' ); ?></h3>
38 <i class="wpbc_ui_el__vert_menu_root_section_icon menu_icon icon-1x wpbc-bi-chevron-right"></i>
39 </button>
40
41 <div class="group__fields" id="<?php echo esc_attr( $panel_id_basic ); ?>" aria-hidden="false">
42 <?php
43
44 // Slug / Key.
45 WPBC_BFB_Setting_Options::print_option(
46 array(
47 'type' => 'input',
48 'input_type' => 'text',
49 'input_attrs' => array(
50 'placeholder' => __( 'e.g. standard', 'booking' ),
51 'autocomplete' => 'off',
52 'spellcheck' => 'false',
53 ),
54 'key' => 'bfb_form_details__form_name',
55 'scope' => 'ui',
56 'default' => '',
57 'label' => __( 'Slug / Key', 'booking' ),
58 'help' => __( 'Form key used in shortcodes.', 'booking' ),
59 'attr' => array(
60 'data-wpbc-bfb-form-details' => 'form_name',
61 ),
62 )
63 );
64
65 // Title.
66 WPBC_BFB_Setting_Options::print_option(
67 array(
68 'type' => 'input',
69 'input_type' => 'text',
70 'input_attrs' => array(
71 'placeholder' => __( 'Displayed name for this form', 'booking' ),
72 ),
73 'key' => 'bfb_form_details__title',
74 'scope' => 'ui',
75 'default' => '',
76 'label' => __( 'Title', 'booking' ),
77 'help' => __( 'Shown in admin UI.', 'booking' ),
78 'attr' => array(
79 'data-wpbc-bfb-form-details' => 'title',
80 ),
81 )
82 );
83
84 $picture_field_id = 'wpbc_bfb_setting__bfb_form_details__picture_url';
85 ?>
86 <label><strong><?php esc_html_e( 'Picture', 'booking' ); ?></strong></label>
87 <div class="wpbc_bfb__form_details_media" data-wpbc-bfb-form-details-media="1" style="display: flex;flex-flow: column wrap;align-items: center;">
88 <div class="wpbc_bfb__form_details_media__preview wpbc_media_upload_button"
89 role="button"
90 tabindex="0"
91 aria-label="<?php echo esc_attr__( 'Selected image preview', 'booking' ); ?>" style="margin: 0 0 20px;"
92 data-modal_title="<?php echo esc_attr__( 'Select Image', 'booking' ); ?>"
93 data-btn_title="<?php echo esc_attr__( 'Use this image', 'booking' ); ?>"
94 data-url_field="<?php echo esc_attr( $picture_field_id ); ?>"
95 >
96 <img src="" alt="" class="wpbc_bfb__form_details_media__img" style="display:none;max-width: 100%;height: auto;" />
97 <i class="wpbc_bfb__form_details_media__placeholder menu_icon icon-1x wpbc-bi-image-fill" aria-hidden="true" style="display:none;"></i>
98 </div>
99
100 <div class="wpbc_bfb__form_details_media__actions">
101 <button type="button" class="button wpbc_media_upload_button" id="wpbc_bfb__form_details_select_image"
102 data-modal_title="<?php echo esc_attr__( 'Select Image', 'booking' ); ?>"
103 data-btn_title="<?php echo esc_attr__( 'Use this image', 'booking' ); ?>"
104 data-url_field="<?php echo esc_attr( $picture_field_id ); ?>"
105 >
106 <?php esc_html_e( 'Select image', 'booking' ); ?>
107 </button>
108 <button type="button" class="button" id="wpbc_bfb__form_details_remove_image">
109 <?php esc_html_e( 'Remove', 'booking' ); ?>
110 </button>
111 </div>
112 </div>
113 <?php
114 // Picture URL (filled by WP Media in JS).
115 WPBC_BFB_Setting_Options::print_option(
116 array(
117 'type' => 'input',
118 'input_type' => 'text',
119 'input_attrs' => array(
120 'placeholder' => __( 'Select image…', 'booking' ),
121 'readonly' => 'readonly',
122 ),
123 'key' => 'bfb_form_details__picture_url',
124 'scope' => 'ui',
125 'default' => '',
126 'label' => '',
127 'help' => __( 'Used as a thumbnail.', 'booking' ),
128 'attr' => array(
129 'data-wpbc-bfb-form-details' => 'picture_url',
130 ),
131 )
132 );
133
134 // Description.
135 WPBC_BFB_Setting_Options::print_option(
136 array(
137 'type' => 'textarea',
138 'input_attrs' => array(
139 'placeholder' => __( 'Short description (optional)', 'booking' ),
140 'rows' => 3,
141 ),
142 'key' => 'bfb_form_details__description',
143 'scope' => 'ui',
144 'default' => '',
145 'label' => __( 'Description', 'booking' ),
146 'help' => __( 'Optional admin note.', 'booking' ),
147 'attr' => array(
148 'data-wpbc-bfb-form-details' => 'description',
149 ),
150 )
151 );
152
153 ?>
154 </div>
155 </section>
156 <?php
157
158 $panel_id_danger = 'wpbc_bfb_form_details_panel_danger';
159 ?>
160 <section class="wpbc_bfb__inspector__group wpbc_ui__collapsible_group" data-group="form-details-danger">
161 <button type="button" class="group__header" role="button" aria-expanded="false" aria-controls="<?php echo esc_attr( $panel_id_danger ); ?>">
162 <h3><?php esc_html_e( 'Danger zone', 'booking' ); ?></h3>
163 <i class="wpbc_ui_el__vert_menu_root_section_icon menu_icon icon-1x wpbc-bi-chevron-right"></i>
164 </button>
165
166 <div class="group__fields" id="<?php echo esc_attr( $panel_id_danger ); ?>" aria-hidden="true">
167
168 <p class="description">
169 <?php esc_html_e( 'Delete this custom form from the database. This action cannot be undone.', 'booking' ); ?>
170 </p>
171
172 <div class="ui_element" style="display: flex;flex-flow: column nowrap;align-items: center;">
173 <button type="button"
174 class="button button-secondary wpbc_ui_control wpbc_ui_button wpbc_ui_button_danger button-link-delete"
175 id="wpbc_bfb__form_details_delete_form"
176 data-wpbc-bfb-delete-nonce="<?php echo esc_attr( wp_create_nonce( 'wpbc_bfb_form_delete' ) ); ?>"
177 data-wpbc-bfb-delete-action="<?php echo esc_attr( 'WPBC_AJX_BFB_DELETE_FORM_CONFIG' ); ?>"
178 >
179 <span class="in-button-text"><?php esc_html_e( 'Delete form', 'booking' ); ?></span> <i class="menu_icon icon-1x wpbc_icn_delete_outline"></i>
180 </button>
181 </div>
182
183 <p class="description" id="wpbc_bfb__form_details_delete_form__note" style="display:none;margin-top:6px;">
184 <?php esc_html_e( 'The Standard form cannot be deleted.', 'booking' ); ?>
185 </p>
186
187 </div>
188 </section>
189 <?php
190
191 }
192