PluginProbe
Booking Calendar / 11.9
Booking Calendar v11.9
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
← All changes | includes/_front_end/class-fe-render-form-body.php +36 -2 11.4.2 → 11.9 View file →
@@ -121,9 +121,35 @@
121 121
122 122 // 3. Postprocess Form Conent - regarding settings - e.g.: $source_res['bfb_settings'] = [ options = [ booking_form_theme = "wpbc_theme_dark_1", .... ], ...
123 123 $wrapped = apply_filters( 'wpbc_booking_form__wrapped_html__before_inline_scripts', $wrapped, $source_res['bfb_settings'], $resource_id, $custom_booking_form );
124 124
125 - $wrapped .= WPBC_FE_Inline_Scripts::collect( $resource_id );
125 + /**
126 + * Filters whether the current booking form render should collect legacy
127 + * page-level inline scripts.
128 + *
129 + * Request-local administration previews initialize their returned markup
130 + * through an explicit bootstrap payload. They must not queue callbacks on
131 + * the parent administration page because the preview form can be replaced
132 + * before those callbacks run.
133 + *
134 + * @since 11.9.0
135 + *
136 + * @param bool $should_collect Whether legacy inline scripts should be collected.
137 + * @param int $resource_id Booking resource ID used by the rendered form.
138 + * @param string $custom_booking_form Booking form slug requested by the renderer.
139 + * @param string $form_status Normalized renderer status such as published or preview.
140 + */
141 + $should_collect_inline_scripts = (bool) apply_filters(
142 + 'wpbc_booking_form__should_collect_inline_scripts',
143 + true,
144 + $resource_id,
145 + $custom_booking_form,
146 + $form_status
147 + );
148 +
149 + if ( $should_collect_inline_scripts ) {
150 + $wrapped .= WPBC_FE_Inline_Scripts::collect( $resource_id );
151 + }
126 152
127 153 // Info: Hook for addons. Postprocess Form Conent - regarding settings - e.g.: $source_res['bfb_settings'] = [ options = [ booking_form_theme = "wpbc_theme_dark_1", .... ], ...
128 154 $wrapped = apply_filters( 'wpbc_booking_form__wrapped_html__after_inline_scripts', $wrapped, $source_res['bfb_settings'], $resource_id, $custom_booking_form );
129 155
@@ -570,9 +596,17 @@
570 596 if ( '' === $bfb_form_html ) {
571 597
572 598 $render_args = array_merge( $custom_params, array( 'booking_type' => (int) $resource_id ) );
573 599
574 - $bfb_source = wpbc_lang( $bfb_source );
600 + /*
601 + * Do not pass the complete Builder form through wpbc_lang(). Builder
602 + * labels and option values may contain legacy [lang=LOCALE] markers.
603 + * Parsing one of those inline markers as a whole-form language block
604 + * truncates everything before/after the matching field and can leave an
605 + * incomplete form on the front end. BFB multilingual forms are separate
606 + * custom forms and are selected by their form slug.
607 + */
608 + $bfb_source = (string) $bfb_source;
575 609
576 610 // Replace custom params in the source (legacy behavior).
577 611 if ( ! empty( $custom_params ) ) {
578 612 foreach ( $custom_params as $custom_params_key => $custom_params_value ) {