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/page-form-builder/assets/template-records/bfb-activate-templates.php +51 -24 11.6 → 11.9 View file →
@@ -1,4 +1,4 @@
1 1 <?php
2 2 /**
3 3 * Booking Form Builder - Bundled templates activation/update helpers.
4 4 *
@@ -105,9 +105,9 @@
105 105 * - upsert = insert if missing, update existing row when seed_version increases.
106 106 *
107 107 * @return array
108 108 */
109 -function wpbc_bfb_activation__get_templates_registry() {
109 +function wpbc_bfb_activation__get_templates_registry() {
110 110
111 111 $templates = array();
112 112 $template_files = array(
113 113
@@ -137,13 +137,13 @@
137 137 wpbc_bfb_activation__get_templates_dir_path() . '/dates_form_with_vertical_layout.php',
138 138 wpbc_bfb_activation__get_templates_dir_path() . '/dates_form_wizard_2_steps.php',
139 139
140 140
141 - // Hints
142 - wpbc_bfb_activation__get_templates_dir_path() . '/time_slots_20_min_3_steps_review_with_hints.php',
143 - wpbc_bfb_activation__get_templates_dir_path() . '/time_appointments_3_steps_review_with_hints.php',
144 - wpbc_bfb_activation__get_templates_dir_path() . '/dates_advanced_3_steps_review_with_hints.php',
145 - wpbc_bfb_activation__get_templates_dir_path() . '/dates_2_columns_sidebar_hints.php',
141 + // Hints
142 + wpbc_bfb_activation__get_templates_dir_path() . '/time_slots_20_min_3_steps_review_with_hints.php',
143 + wpbc_bfb_activation__get_templates_dir_path() . '/time_appointments_3_steps_review_with_hints.php',
144 + wpbc_bfb_activation__get_templates_dir_path() . '/dates_advanced_3_steps_review_with_hints.php',
145 + wpbc_bfb_activation__get_templates_dir_path() . '/dates_2_columns_sidebar_hints.php',
146 146
147 147 // Example future records:
148 148 // wpbc_bfb_activation__get_templates_dir_path() . '/template-contact-inquiry.php',
149 149 // wpbc_bfb_activation__get_templates_dir_path() . '/template-event-registration.php',
@@ -165,21 +165,22 @@
165 165 )
166 166 );
167 167 }
168 168
169 - /*
170 - * Template cards are listed newest-first, with the row ID as the final
171 - * tie-breaker. Seed the preferred Appointment flow after every other bundled
172 - * template so it is the first matching card after a clean activation.
173 - */
174 - $template_files[] = wpbc_bfb_activation__get_templates_dir_path() . '/appointments_services_flow.php';
175 -
176 - /*
177 - * New Full Day - Booking Forms - 1st in the list.
178 - */
179 - $template_files[] = wpbc_bfb_activation__get_templates_dir_path() . '/dates_form_with_inline_hints.php';
180 -
181 - foreach ( $template_files as $template_file ) {
169 + /*
170 + * Template cards are listed newest-first, with the row ID as the final
171 + * tie-breaker. Append preferred templates in increasing display priority.
172 + * The last bundled template seeded is therefore the first library card after
173 + * activation. The insert-only records below never overwrite installed rows.
174 + */
175 + $template_files[] = wpbc_bfb_activation__get_templates_dir_path() . '/appointments_services_flow.php';
176 + $template_files[] = wpbc_bfb_activation__get_templates_dir_path() . '/appointments_services_selection_summary.php';
177 + $template_files[] = wpbc_bfb_activation__get_templates_dir_path() . '/dates_form_with_inline_hints.php';
178 + $template_files[] = wpbc_bfb_activation__get_templates_dir_path() . '/dates_vertical_hints_full_days.php';
179 + $template_files[] = wpbc_bfb_activation__get_templates_dir_path() . '/dates_2_columns_hints_full_days.php';
180 + $template_files[] = wpbc_bfb_activation__get_templates_dir_path() . '/time_slots_2_columns_hints.php';
181 +
182 + foreach ( $template_files as $template_file ) {
182 183 if ( file_exists( $template_file ) ) {
183 184 $template_config = require $template_file;
184 185
185 186 if ( is_array( $template_config ) ) {
@@ -192,13 +193,39 @@
192 193 * Allow third-party code or future modules to register bundled templates.
193 194 */
194 195 $templates = apply_filters( 'wpbc_bfb_activation__templates_registry', $templates );
195 196
196 - return $templates;
197 -}
198 -
199 -/**
200 - * Add default form appearance settings to bundled template settings_json.
197 + return $templates;
198 +}
199 +
200 +/**
201 + * Keep the replacement Appointment template adjacent to its legacy predecessor.
202 + *
203 + * The shared list endpoint owns the neutral ordering mechanic. This domain
204 + * registration supplies only the two stable template slugs and does not change
205 + * either insert-only row or its saved timestamp.
206 + *
207 + * @param array $adjacencies Registered template-library adjacency pairs.
208 + *
209 + * @return array Filtered adjacency pairs.
210 + */
211 +function wpbc_bfb_activation__register_template_library_adjacencies( $adjacencies ) {
212 +
213 + if ( ! is_array( $adjacencies ) ) {
214 + $adjacencies = array();
215 + }
216 +
217 + $adjacencies[] = array(
218 + 'before' => 'appointments_services_selection_summary',
219 + 'after' => 'appointments_services_flow',
220 + );
221 +
222 + return $adjacencies;
223 +}
224 +add_filter( 'wpbc_bfb_template_library_adjacencies', 'wpbc_bfb_activation__register_template_library_adjacencies' );
225 +
226 +/**
227 + * Add default form appearance settings to bundled template settings_json.
201 228 *
202 229 * Individual templates can override any key in their own settings_json; this only fills missing values.
203 230 *
204 231 * @param string $settings_json Template settings JSON.