PluginProbe
Booking Calendar / 11.0
Booking Calendar v11.0
11.9 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 All 205 releases
booking / includes / page-form-builder / field-packs / accept-terms / field-accept-terms-wptpl.php

field-accept-terms-wptpl.php in Booking Calendar 11.0, at includes/page-form-builder/field-packs/accept-terms/field-accept-terms-wptpl.php

602 lines 25.8 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2 /**
3 * WPBC BFB Pack: Accept Terms field (WP-template–driven, sentence + token links)
4 *
5 * Strategy:
6 * - User writes one sentence with tokens, for example:
7 * "the {terms} and {conditions}"
8 * - User defines link rows for each token:
9 * - key: terms
10 * - text: terms
11 * - type: url / popup / anchor
12 * - destination: URL or popup id or anchor id
13 *
14 * File: ../includes/page-form-builder/field-packs/accept-terms/field-accept-terms-wptpl.php
15 *
16 * @package Booking Calendar
17 * @author wpdevelop, oplugins
18 * @since 11.0.0
19 * @modified 2026-04-05
20 * @version 1.0.2
21 */
22
23 if ( ! defined( 'ABSPATH' ) ) {
24 exit;
25 }
26
27 /**
28 * Register the "accept_terms" field pack.
29 *
30 * @param array $packs Registered field packs.
31 *
32 * @return array
33 */
34 function wpbc_bfb_register_field_packs__field_accept_terms_wptpl( $packs ) {
35
36 $packs['accept_terms'] = array(
37 'kind' => 'field',
38 'type' => 'accept_terms',
39 'label' => __( 'Accept Terms', 'booking' ),
40 'icon' => 'wpbc_icn_check_box0',
41 'usage_key' => 'accept_terms',
42 'schema' => array(
43 'props' => array(
44 'title' => array( 'type' => 'string', 'default' => '' ),
45 'name' => array( 'type' => 'string', 'default' => 'terms' ),
46 'html_id' => array( 'type' => 'string', 'default' => '' ),
47 'required' => array( 'type' => 'boolean', 'default' => true ),
48 'cssclass' => array( 'type' => 'string', 'default' => '' ),
49 'help' => array( 'type' => 'string', 'default' => '' ),
50 'checkbox_text' => array( 'type' => 'string', 'default' => __( 'I accept', 'booking' ) ),
51 'sentence' => array( 'type' => 'string', 'default' => __( 'the {terms} and {conditions}', 'booking' ) ),
52 'links' => array(
53 'type' => 'array',
54 'default' => array(
55 array(
56 'key' => 'terms',
57 'text' => __( 'terms', 'booking' ),
58 'link_type' => 'url',
59 'destination' => 'https://server.com/terms/',
60 'target' => '_blank',
61 'cssclass' => '',
62 ),
63 array(
64 'key' => 'conditions',
65 'text' => __( 'conditions', 'booking' ),
66 'link_type' => 'url',
67 'destination' => 'https://server.com/conditions/',
68 'target' => '_blank',
69 'cssclass' => '',
70 ),
71 ),
72 ),
73 // 'min_width' => array( 'type' => 'string', 'default' => '260px' ),
74 ),
75 ),
76 'templates_printer' => 'wpbc_bfb_field_accept_terms_wptpl_print_templates',
77 );
78
79 return $packs;
80 }
81 add_filter( 'wpbc_bfb_register_field_packs', 'wpbc_bfb_register_field_packs__field_accept_terms_wptpl' );
82
83
84 /**
85 * Enqueue JS renderer for the Accept Terms field pack.
86 *
87 * @param string $page Current admin page slug.
88 *
89 * @return void
90 */
91 function wpbc_bfb_enqueue__field_accept_terms_wptpl_js( $page ) {
92
93 wp_enqueue_script(
94 'wpbc-bfb_field_accept_terms_wptpl',
95 wpbc_plugin_url( '/includes/page-form-builder/field-packs/accept-terms/_out/field-accept-terms-wptpl.js' ),
96 array( 'wp-util', 'wpbc-bfb' ),
97 WP_BK_VERSION_NUM,
98 true
99 );
100 }
101 add_action( 'wpbc_enqueue_js_field_pack', 'wpbc_bfb_enqueue__field_accept_terms_wptpl_js', 10, 1 );
102
103
104 /**
105 * Print wp.template() blocks for the Accept Terms field.
106 *
107 * @param string $page Current admin page slug.
108 *
109 * @return void
110 */
111 function wpbc_bfb_field_accept_terms_wptpl_print_templates( $page ) {
112
113 if ( WPBC_BFB_BUILDER_PAGE_SLUG !== $page ) {
114 return;
115 }
116 ?>
117 <script type="text/html" id="tmpl-wpbc-bfb-field-accept_terms">
118 <span class="wpbc_bfb__noaction wpbc_bfb__no-drag-zone" inert="">
119 <#
120 var is_req = ( true === data.required || 'true' === data.required || 1 === data.required || '1' === data.required );
121 var field_id = data.html_id || data.id || data.name || 'accept_terms';
122 var field_name = data.name || data.id || 'terms';
123 #>
124
125 <# if ( data.title && data.title !== '' ) { #>
126 <label class="wpbc_bfb__field-label" <# if ( data.html_id ) { #> for="{{ field_id }}" <# } #>>
127 {{ data.title }} <# if ( is_req ) { #><span aria-hidden="true">*</span><# } #>
128 </label>
129 <# } #>
130
131 <span class="wpbc_wrap_text wpdev-form-control-wrap {{ data.cssclass || '' }}">
132 <label class="wpbc_bfb__checkbox-item wpbc_bfb__accept_terms_item">
133 <input
134 type="checkbox"
135 class="wpbc_bfb__preview-input wpbc_bfb__preview-checkbox"
136 name="{{ field_name }}"
137 value="{{ data.checkbox_text || '<?php echo esc_js( __( 'I accept', 'booking' ) ); ?>' }}"
138 tabindex="-1"
139 aria-disabled="true"
140 <# if ( is_req ) { #> required aria-required="true" <# } #>
141 id="{{ field_id }}"
142 >
143 <span class="wpbc_bfb__checkbox-label">
144 {{ data.checkbox_text || '<?php echo esc_js( __( 'I accept', 'booking' ) ); ?>' }}{{{ data.sentence_preview_html || '' }}}
145 </span>
146 </label>
147 </span>
148
149 <# if ( data.help ) { #>
150 <div class="wpbc_bfb__help">{{ data.help }}</div>
151 <# } #>
152 </span>
153 </script>
154
155 <script type="text/html" id="tmpl-wpbc-bfb-inspector-accept_terms">
156 <style type="text/css">
157 .wpbc_admin .wpbc_ui_el__vert_right_bar__wrapper:has(.wpbc_bfb__inspector_accept_terms) {
158 --wpbc_ui_left_vert_nav__width_max: Min(330px, 100%);
159 }
160
161 .wpbc_bfb__inspector_accept_terms .wpbc_bfb__accept_terms_links_list {
162 display: flex;
163 flex-direction: column;
164 gap: 8px;
165 }
166
167 .wpbc_bfb__inspector_accept_terms .wpbc_bfb__accept_terms_link_row {
168 display: flex;
169 flex-flow: row wrap;
170 align-items: center;
171 gap: 8px;
172 padding: 10px 0;
173 border-bottom: 1px solid #dcdcde;
174 }
175
176 .wpbc_bfb__inspector_accept_terms .wpbc_bfb__accept_terms_link_row span {
177 flex: 0 1 30%;
178 }
179
180 .wpbc_bfb__inspector_accept_terms .wpbc_bfb__accept_terms_link_row input,
181 .wpbc_bfb__inspector_accept_terms .wpbc_bfb__accept_terms_link_row select {
182 flex: 1 1 50%;
183 }
184
185 .wpbc_bfb__inspector_accept_terms .wpbc_bfb__accept_terms_link_row:last-child {
186 border-bottom: 0;
187 }
188
189 .wpbc_bfb__inspector_accept_terms .wpbc_bfb__accept_terms_prop_label {
190 flex: 0 0 92px;
191 margin: 0;
192 color: #50575e;
193 white-space: nowrap;
194 }
195
196 .wpbc_bfb__inspector_accept_terms .wpbc_bfb__accept_terms_link_key {
197 flex: 1 1 calc(100% - 100px);
198 min-width: 140px;
199 }
200
201 .wpbc_bfb__inspector_accept_terms .wpbc_bfb__accept_terms_link_text {
202 flex: 1 1 calc(100% - 100px);
203 min-width: 160px;
204 }
205
206 .wpbc_bfb__inspector_accept_terms .wpbc_bfb__accept_terms_link_type {
207 flex: 1 1 calc(100% - 100px);
208 min-width: 120px;
209 }
210
211 .wpbc_bfb__inspector_accept_terms .wpbc_bfb__accept_terms_link_destination {
212 flex: 1 1 calc(100% - 100px);
213 min-width: 180px;
214 }
215
216 .wpbc_bfb__inspector_accept_terms .wpbc_bfb__accept_terms_link_target {
217 flex: 1 1 calc(100% - 100px);
218 min-width: 100px;
219 }
220
221 .wpbc_bfb__inspector_accept_terms .wpbc_bfb__accept_terms_link_cssclass {
222 flex: 1 1 calc(100% - 100px);
223 min-width: 140px;
224 }
225
226 .wpbc_bfb__inspector_accept_terms .wpbc_bfb__accept_terms_row_actions {
227 flex: 0 0 40px;
228 width: 40px;
229 margin-left: auto;
230 }
231
232 .wpbc_bfb__inspector_accept_terms [data-wpbc-bfb-accept-terms-available-tokens="1"] {
233 display: flex;
234 flex-flow: row wrap;
235 align-items: center;
236 justify-content: flex-start;
237 gap: 6px;
238 }
239 </style>
240
241 <#
242 var _default_links = [
243 {
244 key : 'terms',
245 text : '<?php echo esc_js( __( 'terms', 'booking' ) ); ?>',
246 link_type : 'url',
247 destination : 'https://server.com/terms/',
248 target : '_blank',
249 cssclass : ''
250 },
251 {
252 key : 'conditions',
253 text : '<?php echo esc_js( __( 'conditions', 'booking' ) ); ?>',
254 link_type : 'url',
255 destination : 'https://server.com/conditions/',
256 target : '_blank',
257 cssclass : ''
258 }
259 ];
260
261 var _has_links_prop = Object.prototype.hasOwnProperty.call( data || {}, 'links' );
262 var _links_raw = _has_links_prop ? data.links : _default_links;
263
264 if ( 'string' === typeof _links_raw ) {
265 try {
266 _links_raw = JSON.parse( _links_raw );
267 } catch ( _links_err ) {
268 _links_raw = _has_links_prop ? [] : _default_links;
269 }
270 }
271
272 var _links2 = Array.isArray( _links_raw )
273 ? _links_raw
274 : ( function( o ) {
275 var a = [], k;
276 for ( k in ( o || {} ) ) {
277 if ( Object.prototype.hasOwnProperty.call( o, k ) ) {
278 a.push( o[ k ] );
279 }
280 }
281 return a;
282 } )( _links_raw );
283 #>
284
285 <div class="wpbc_bfb__inspector_accept_terms" data-type="accept_terms">
286 <div class="wpbc_bfb__inspector__head">
287 <div class="header_container">
288 <div class="header_title_content">
289 <h3 class="title"><?php echo esc_html__( 'Accept Terms', 'booking' ); ?></h3>
290 <div class="desc"><?php echo esc_html__( 'Write one sentence with tokens like {terms}, then define the links below.', 'booking' ); ?></div>
291 </div>
292 <div class="actions wpbc_ajx_toolbar wpbc_no_borders">
293 <div class="ui_container ui_container_small">
294 <div class="ui_group">
295 <div class="ui_element">
296 <button type="button" class="button button-secondary wpbc_ui_control wpbc_ui_button" data-action="deselect" aria-label="<?php echo esc_attr__( 'Deselect', 'booking' ); ?>">
297 <i class="menu_icon icon-1x wpbc_icn_remove_done"></i>
298 </button>
299 <button type="button" class="button button-secondary wpbc_ui_control wpbc_ui_button" data-action="scrollto" aria-label="<?php echo esc_attr__( 'Scroll to field', 'booking' ); ?>">
300 <i class="menu_icon icon-1x wpbc_icn_ads_click filter_center_focus"></i>
301 </button>
302 </div>
303 <div class="ui_element">
304 <button type="button" class="button button-secondary wpbc_ui_control wpbc_ui_button" data-action="move-up" aria-label="<?php echo esc_attr__( 'Move up', 'booking' ); ?>">
305 <i class="menu_icon icon-1x wpbc_icn_arrow_upward"></i>
306 </button>
307 <button type="button" class="button button-secondary wpbc_ui_control wpbc_ui_button" data-action="move-down" aria-label="<?php echo esc_attr__( 'Move down', 'booking' ); ?>">
308 <i class="menu_icon icon-1x wpbc_icn_arrow_downward"></i>
309 </button>
310 </div>
311 <div class="ui_element">
312 <button data-action="duplicate" type="button" class="button button-secondary wpbc_ui_control wpbc_ui_button" aria-label="<?php echo esc_attr__( 'Duplicate', 'booking' ); ?>">
313 <i class="menu_icon icon-1x wpbc_icn_content_copy"></i>
314 </button>
315 <button data-action="delete" type="button" class="button button-secondary wpbc_ui_control wpbc_ui_button wpbc_ui_button_danger button-link-delete" aria-label="<?php echo esc_attr__( 'Delete', 'booking' ); ?>">
316 <span class="in-button-text"><?php echo esc_html__( 'Delete', 'booking' ); ?></span>&nbsp;&nbsp;<i class="menu_icon icon-1x wpbc_icn_delete_outline"></i>
317 </button>
318 </div>
319 </div>
320 </div>
321 </div>
322 </div>
323 </div>
324
325 <div class="wpbc_bfb__inspector__body" data-wpbc-bfb-accept-terms-panel="1">
326
327 <section class="wpbc_bfb__inspector__group wpbc_ui__collapsible_group is-open" data-group="basic">
328 <button type="button" class="group__header">
329 <h3><?php echo esc_html__( 'Basic', 'booking' ); ?></h3>
330 <i class="wpbc_ui_el__vert_menu_root_section_icon menu_icon icon-1x wpbc-bi-chevron-right"></i>
331 </button>
332
333 <div class="group__fields inspector__group__fields__times">
334
335 <div class="inspector__row">
336 <label class="inspector__label"><?php echo esc_html__( 'Required', 'booking' ); ?></label>
337 <div class="inspector__control">
338 <input
339 type="checkbox"
340 class="inspector__checkbox inspector__input"
341 data-inspector-key="required"
342 <# if ( true === data.required || 'true' === data.required || 1 === data.required || '1' === data.required ) { #>
343 checked="checked" aria-checked="true"
344 <# } else { #>
345 aria-checked="false"
346 <# } #>
347 >
348 <p class="wpbc_bfb__help" style="margin-top:6px;"><?php echo esc_html__( 'Enable this option to require accepting this checkbox before form submission.', 'booking' ); ?></p>
349 </div>
350 </div>
351
352 <div class="inspector__row">
353 <label class="inspector__label"><?php echo esc_html__( 'Name', 'booking' ); ?></label>
354 <div class="inspector__control">
355 <input type="text" class="inspector__input" data-inspector-key="name" value="{{ data.name || 'terms' }}">
356 </div>
357 </div>
358
359 <div class="inspector__row">
360 <label class="inspector__label"><?php echo esc_html__( 'Checkbox text', 'booking' ); ?></label>
361 <div class="inspector__control">
362 <input type="text" class="inspector__input" data-inspector-key="checkbox_text" value="{{ data.checkbox_text || '<?php echo esc_js( __( 'I accept', 'booking' ) ); ?>' }}">
363 </div>
364 </div>
365
366 <div class="inspector__row">
367 <label class="inspector__label"><?php echo esc_html__( 'Sentence after checkbox', 'booking' ); ?></label>
368 <div class="inspector__control">
369 <textarea class="inspector__textarea" rows="3" data-inspector-key="sentence">{{ data.sentence || '<?php echo esc_js( __( 'the {terms} and {conditions}', 'booking' ) ); ?>' }}</textarea>
370
371 <div class="wpbc_bfb__help" data-wpbc-bfb-accept-terms-available-tokens="1">
372 <# _links2.forEach( function( _link_item ) { #>
373 <button type="button" class="button button-secondary button-small js-insert-token-from-hint" data-token="{{ _link_item.key || '' }}">
374 <# print( '{' + ( _link_item.key || '' ) + '}' ); #>
375 </button>
376 <# } ); #>
377 </div>
378
379 <p class="wpbc_bfb__help" style="margin-top:6px;"><?php echo esc_html__( 'Use tokens inside braces, for example: {terms} or {privacy_policy}.', 'booking' ); ?></p>
380 <div class="wpbc_bfb__help" data-wpbc-bfb-accept-terms-status="1" style="margin-top:8px;"></div>
381 </div>
382 </div>
383
384 <div class="inspector__row wpbc_bfb__options_editor">
385 <label class="inspector__label"><?php echo esc_html__( 'Link definitions', 'booking' ); ?></label>
386
387 <div class="inspector__control">
388 <div class="wpbc_bfb__options_list wpbc_bfb__accept_terms_links_list">
389 <# _links2.forEach( function( opt, idx ) { #>
390 <div class="wpbc_bfb__options_row wpbc_bfb__accept_terms_link_row" data-index="{{ idx }}">
391 <span class="wpbc_bfb__accept_terms_prop_label"><?php echo esc_html__( 'Token Key', 'booking' ); ?>:</span>
392 <input type="text" class="wpbc_bfb__accept_terms_link_key" placeholder="<?php echo esc_attr__( 'Token key', 'booking' ); ?>" value="{{ opt && opt.key || '' }}">
393
394 <span class="wpbc_bfb__accept_terms_prop_label"><?php echo esc_html__( 'Text', 'booking' ); ?>:</span>
395 <input type="text" class="wpbc_bfb__accept_terms_link_text" placeholder="<?php echo esc_attr__( 'Visible text', 'booking' ); ?>" value="{{ opt && opt.text || '' }}">
396
397 <span class="wpbc_bfb__accept_terms_prop_label"><?php echo esc_html__( 'Type', 'booking' ); ?>:</span>
398 <select class="wpbc_bfb__accept_terms_link_type">
399 <option value="url" <# if ( 'url' === ( opt && opt.link_type || 'url' ) ) { #> selected="selected" <# } #> ><?php echo esc_html__( 'URL', 'booking' ); ?></option>
400 <option value="anchor" <# if ( 'anchor' === ( opt && opt.link_type || '' ) ) { #> selected="selected" <# } #> ><?php echo esc_html__( 'Anchor', 'booking' ); ?></option>
401 </select>
402
403 <span class="wpbc_bfb__accept_terms_prop_label"><?php echo esc_html__( 'Destination', 'booking' ); ?>:</span>
404 <input type="text" class="wpbc_bfb__accept_terms_link_destination" placeholder="<?php echo esc_attr__( 'Destination', 'booking' ); ?>" value="{{ opt && opt.destination || '' }}">
405
406 <span class="wpbc_bfb__accept_terms_prop_label"><?php echo esc_html__( 'Target', 'booking' ); ?>:</span>
407 <select class="wpbc_bfb__accept_terms_link_target">
408 <option value="_self" <# if ( '_self' === ( opt && opt.target || '' ) ) { #> selected="selected" <# } #> >_self</option>
409 <option value="_blank" <# if ( '_blank' === ( opt && opt.target || '_blank' ) ) { #> selected="selected" <# } #> >_blank</option>
410 </select>
411
412 <span class="wpbc_bfb__accept_terms_prop_label"><?php echo esc_html__( 'CSS', 'booking' ); ?>:</span>
413 <input type="text" class="wpbc_bfb__accept_terms_link_cssclass" placeholder="<?php echo esc_attr__( 'CSS class', 'booking' ); ?>" value="{{ opt && opt.cssclass || '' }}">
414
415 <div class="wpbc_ui_el wpbc_ui_el_container wpbc_ui_el__dropdown wpbc_bfb__accept_terms_row_actions">
416 <a href="javascript:void(0)" data-toggle="wpbc_dropdown" aria-expanded="false" class="ul_dropdown_menu_toggle">
417 <i class="menu_icon icon-1x wpbc_icn_more_vert"></i>
418 </a>
419 <ul class="ul_dropdown_menu" role="menu" style="right:0px; left:auto;">
420 <li>
421 <a class="ul_dropdown_menu_li_action js-link-row-action" data-action="add_after" href="javascript:void(0)">
422 <?php echo esc_html__( 'Add New', 'booking' ); ?>
423 <i class="menu_icon icon-1x wpbc_icn_add_circle"></i>
424 </a>
425 </li>
426 <li>
427 <a class="ul_dropdown_menu_li_action js-link-row-action" data-action="duplicate" href="javascript:void(0)">
428 <?php echo esc_html__( 'Duplicate', 'booking' ); ?>
429 <i class="menu_icon icon-1x wpbc_icn_content_copy"></i>
430 </a>
431 </li>
432 <li class="divider"></li>
433 <li>
434 <a class="ul_dropdown_menu_li_action js-link-row-action" data-action="remove" href="javascript:void(0)">
435 <?php echo esc_html__( 'Remove', 'booking' ); ?>
436 <i class="menu_icon icon-1x wpbc_icn_delete_outline"></i>
437 </a>
438 </li>
439 </ul>
440 </div>
441 </div>
442 <# } ); #>
443 </div>
444
445 <div class="wpbc_bfb__options_toolbar">
446 <div class="wpbc_bfb__options_toolbar wpbc_inline_inputs">
447 <div class="inspector__control inspector__w_100" style="text-align:center;">
448 <button type="button" class="button button-secondary js-add-link-definition">
449 <i class="wpbc_ui_el__vert_nav_icon tooltip_right_offset menu_icon icon-1x wpbc_icn_add_circle" aria-hidden="true"></i>
450 <?php echo esc_html__( 'Add link', 'booking' ); ?>
451 </button>
452 </div>
453 </div>
454 </div>
455
456 <#
457 var _links_json = JSON.stringify( _links2 || [] );
458 _links_json = _links_json.replace( /<\/textarea/gi, '<\\/textarea' );
459 #>
460 <textarea class="wpbc_bfb__accept_terms_links_state inspector__input" data-inspector-key="links" hidden>{{ _links_json }}</textarea>
461
462 <p class="wpbc_bfb__help" style="margin-top:8px;"><?php echo esc_html__( 'Token key is used inside the sentence as {token_key}. Destination means URL or anchor ID depending on selected type.', 'booking' ); ?></p>
463 </div>
464 </div>
465
466 <div class="inspector__row">
467 <label class="inspector__label"><?php echo esc_html__( 'Title', 'booking' ); ?></label>
468 <div class="inspector__control">
469 <input type="text" class="inspector__input" data-inspector-key="title" value="{{ data.title || '' }}">
470 <p class="wpbc_bfb__help" style="margin-top:6px;"><?php echo esc_html__( 'Optional label above the checkbox row.', 'booking' ); ?></p>
471 </div>
472 </div>
473
474 <div class="inspector__row">
475 <label class="inspector__label"><?php echo esc_html__( 'Help text', 'booking' ); ?></label>
476 <div class="inspector__control">
477 <textarea class="inspector__textarea" rows="3" data-inspector-key="help">{{ data.help || '' }}</textarea>
478 </div>
479 </div>
480
481 </div>
482 </section>
483
484 <section class="wpbc_bfb__inspector__group wpbc_ui__collapsible_group" data-group="appearance">
485 <button type="button" class="group__header">
486 <h3><?php echo esc_html__( 'Appearance', 'booking' ); ?></h3>
487 <i class="wpbc_ui_el__vert_menu_root_section_icon menu_icon icon-1x wpbc-bi-chevron-right"></i>
488 </button>
489 <div class="group__fields">
490
491 <div class="inspector__row">
492 <label class="inspector__label"><?php echo esc_html__( 'CSS class', 'booking' ); ?></label>
493 <div class="inspector__control">
494 <input type="text" class="inspector__input" data-inspector-key="cssclass" value="{{ data.cssclass || '' }}">
495 </div>
496 </div>
497
498 <div class="inspector__row">
499 <label class="inspector__label"><?php echo esc_html__( 'HTML ID', 'booking' ); ?></label>
500 <div class="inspector__control">
501 <input type="text" class="inspector__input" data-inspector-key="html_id" value="{{ data.html_id || '' }}">
502 </div>
503 </div>
504 <?php /* ?>
505 <div class="inspector__row">
506 <label class="inspector__label"><?php echo esc_html__( 'Min width', 'booking' ); ?></label>
507 <div class="inspector__control">
508 <input type="text" class="inspector__input" data-inspector-key="min_width" placeholder="260px" value="{{ data.min_width || '260px' }}">
509 </div>
510 </div>
511 <?php */ ?>
512 </div>
513 </section>
514
515 </div>
516 </div>
517 </script>
518
519 <script type="text/html" id="tmpl-wpbc-bfb-inspector-accept_terms-link-row">
520 <div class="wpbc_bfb__options_row wpbc_bfb__accept_terms_link_row" data-index="{{ data.index || 0 }}">
521 <span class="wpbc_bfb__accept_terms_prop_label"><?php echo esc_html__( 'Token Key', 'booking' ); ?>:</span>
522 <input type="text" class="wpbc_bfb__accept_terms_link_key" placeholder="<?php echo esc_attr__( 'Token key', 'booking' ); ?>" value="{{ data.key || '' }}">
523
524 <span class="wpbc_bfb__accept_terms_prop_label"><?php echo esc_html__( 'Text', 'booking' ); ?>:</span>
525 <input type="text" class="wpbc_bfb__accept_terms_link_text" placeholder="<?php echo esc_attr__( 'Visible text', 'booking' ); ?>" value="{{ data.text || '' }}">
526
527 <span class="wpbc_bfb__accept_terms_prop_label"><?php echo esc_html__( 'Type', 'booking' ); ?>:</span>
528 <select class="wpbc_bfb__accept_terms_link_type">
529 <option value="url" <# if ( 'url' === ( data.link_type || 'url' ) ) { #> selected="selected" <# } #> ><?php echo esc_html__( 'URL', 'booking' ); ?></option>
530 <option value="anchor" <# if ( 'anchor' === ( data.link_type || '' ) ) { #> selected="selected" <# } #> ><?php echo esc_html__( 'Anchor', 'booking' ); ?></option>
531 </select>
532
533 <span class="wpbc_bfb__accept_terms_prop_label"><?php echo esc_html__( 'Destination', 'booking' ); ?>:</span>
534 <input type="text" class="wpbc_bfb__accept_terms_link_destination" placeholder="<?php echo esc_attr__( 'Destination', 'booking' ); ?>" value="{{ data.destination || '' }}">
535
536 <span class="wpbc_bfb__accept_terms_prop_label"><?php echo esc_html__( 'Target', 'booking' ); ?>:</span>
537 <select class="wpbc_bfb__accept_terms_link_target">
538 <option value="_self" <# if ( '_self' === ( data.target || '' ) ) { #> selected="selected" <# } #> >_self</option>
539 <option value="_blank" <# if ( '_blank' === ( data.target || '_blank' ) ) { #> selected="selected" <# } #> >_blank</option>
540 </select>
541
542 <span class="wpbc_bfb__accept_terms_prop_label"><?php echo esc_html__( 'CSS', 'booking' ); ?>:</span>
543 <input type="text" class="wpbc_bfb__accept_terms_link_cssclass" placeholder="<?php echo esc_attr__( 'CSS class', 'booking' ); ?>" value="{{ data.cssclass || '' }}">
544
545 <div class="wpbc_ui_el wpbc_ui_el_container wpbc_ui_el__dropdown wpbc_bfb__accept_terms_row_actions">
546 <a href="javascript:void(0)" data-toggle="wpbc_dropdown" aria-expanded="false" class="ul_dropdown_menu_toggle">
547 <i class="menu_icon icon-1x wpbc_icn_more_vert"></i>
548 </a>
549 <ul class="ul_dropdown_menu" role="menu" style="right:0px; left:auto;">
550 <li>
551 <a class="ul_dropdown_menu_li_action js-link-row-action" data-action="add_after" href="javascript:void(0)">
552 <?php echo esc_html__( 'Add New', 'booking' ); ?>
553 <i class="menu_icon icon-1x wpbc_icn_add_circle"></i>
554 </a>
555 </li>
556 <li>
557 <a class="ul_dropdown_menu_li_action js-link-row-action" data-action="duplicate" href="javascript:void(0)">
558 <?php echo esc_html__( 'Duplicate', 'booking' ); ?>
559 <i class="menu_icon icon-1x wpbc_icn_content_copy"></i>
560 </a>
561 </li>
562 <li class="divider"></li>
563 <li>
564 <a class="ul_dropdown_menu_li_action js-link-row-action" data-action="remove" href="javascript:void(0)">
565 <?php echo esc_html__( 'Remove', 'booking' ); ?>
566 <i class="menu_icon icon-1x wpbc_icn_delete_outline"></i>
567 </a>
568 </li>
569 </ul>
570 </div>
571 </div>
572 </script>
573 <?php
574 }
575
576
577 /**
578 * Register the "Accept Terms" palette item.
579 *
580 * @param string $group Palette group.
581 * @param string $position Position in group.
582 *
583 * @return void
584 */
585 function wpbc_bfb_palette_register_items__accept_terms_wptpl( $group, $position ) {
586
587 if ( 'standard' !== $group || 'bottom' !== $position ) {
588 return;
589 }
590 ?>
591 <li class="wpbc_bfb__field"
592 data-id="accept_terms"
593 data-type="accept_terms"
594 data-usage_key="accept_terms"
595 data-label="<?php echo esc_attr( __( 'Accept Terms', 'booking' ) ); ?>">
596 <i class="menu_icon icon-1x wpbc_icn_check_box0 wpbc-bi-check-square"></i>
597 <span class="wpbc_bfb__field-label"><?php echo esc_html( __( 'Accept Terms', 'booking' ) ); ?></span>
598 <span class="wpbc_bfb__field-type">accept_terms</span>
599 </li>
600 <?php
601 }
602 add_action( 'wpbc_bfb_palette_register_items', 'wpbc_bfb_palette_register_items__accept_terms_wptpl', 10, 2 );