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
booking / includes / page-catalog-booking-resources / booking-resources-catalog-config.php

booking-resources-catalog-config.php in Booking Calendar 11.9, at includes/page-catalog-booking-resources/booking-resources-catalog-config.php

636 lines 33.2 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2 /**
3 * Configuration for the independent Booking Resources catalog.
4 *
5 * @package Booking Calendar
6 * @since 11.6.0
7 */
8
9 if ( ! defined( 'ABSPATH' ) ) {
10 exit;
11 }
12
13 /**
14 * Return edition-aware Overview columns matching the established listing.
15 *
16 * The independent catalog owns this declaration and does not call the legacy
17 * listing schema. Unsupported edition columns are omitted before preferences
18 * and requests are validated.
19 *
20 * @return array<string,mixed> Allowed, visible, ordered, and defined columns.
21 */
22 function wpbc_catalog_booking_resources_get_column_config() {
23 $column_definitions = array(
24 'resource' => array(
25 'label' => __( 'Booking resource', 'booking' ),
26 'class' => 'column-resource',
27 'sort_key' => 'title',
28 'required' => true,
29 'reorderable' => true,
30 ),
31 'labels' => array(
32 'label' => __( 'Labels', 'booking' ),
33 'class' => 'column-labels',
34 'sort_key' => '',
35 'required' => false,
36 'reorderable' => true,
37 ),
38 'publishing' => array(
39 'label' => __( 'Publish shortcode', 'booking' ),
40 'class' => 'column-publishing',
41 'sort_key' => '',
42 'required' => false,
43 'reorderable' => true,
44 ),
45 'default_form' => array(
46 'label' => __( 'Default booking form', 'booking' ),
47 'class' => 'column-default-form',
48 'sort_key' => '',
49 'required' => false,
50 'reorderable' => true,
51 ),
52 'structure' => array(
53 'label' => __( 'Parent / child connection', 'booking' ),
54 'class' => 'column-structure',
55 'sort_key' => '',
56 'required' => false,
57 'reorderable' => true,
58 ),
59 'priority' => array(
60 'label' => __( 'Priority', 'booking' ),
61 'class' => 'column-priority',
62 'sort_key' => 'priority',
63 'required' => false,
64 'reorderable' => true,
65 ),
66 'capacity' => array(
67 'label' => __( 'Capacity', 'booking' ),
68 'class' => 'column-capacity',
69 'sort_key' => 'capacity',
70 'required' => false,
71 'reorderable' => true,
72 ),
73 'price' => array(
74 'label' => __( 'Price', 'booking' ),
75 'class' => 'column-price',
76 'sort_key' => 'cost',
77 'required' => false,
78 'reorderable' => true,
79 ),
80 'owner' => array(
81 'label' => __( 'Owner', 'booking' ),
82 'class' => 'column-owner',
83 'sort_key' => '',
84 'required' => false,
85 'reorderable' => true,
86 ),
87 'actions' => array(
88 'label' => __( 'Actions', 'booking' ),
89 'class' => 'column-actions',
90 'sort_key' => '',
91 'required' => true,
92 'reorderable' => true,
93 ),
94 'id' => array(
95 'label' => __( 'ID', 'booking' ),
96 'class' => 'column-id',
97 'sort_key' => 'id',
98 'required' => false,
99 'reorderable' => true,
100 ),
101 );
102
103 if ( ! class_exists( 'wpdev_bk_biz_l' ) ) {
104 unset( $column_definitions['structure'], $column_definitions['priority'], $column_definitions['capacity'] );
105 }
106 if ( ! class_exists( 'wpdev_bk_biz_s' ) ) {
107 unset( $column_definitions['price'] );
108 }
109 if ( ! class_exists( 'wpdev_bk_biz_m' ) ) {
110 unset( $column_definitions['default_form'] );
111 }
112 if (
113 ! class_exists( 'wpdev_bk_multiuser' )
114 || ! (bool) apply_bk_filter( 'multiuser_is_user_can_be_here', true, 'only_super_admin' )
115 ) {
116 unset( $column_definitions['owner'] );
117 }
118
119 $column_ids = array_keys( $column_definitions );
120 $default_visible_columns = class_exists( 'wpdev_bk_personal' )
121 ? array_values( array_intersect( array( 'resource', 'labels', 'capacity', 'price', 'actions', 'id' ), $column_ids ) )
122 : $column_ids;
123
124 return array(
125 'allowed' => $column_ids,
126 'default_visible' => $default_visible_columns,
127 'default_order' => $column_ids,
128 'required' => array_values( array_intersect( array( 'resource', 'actions' ), $column_ids ) ),
129 'definitions' => $column_definitions,
130 );
131 }
132
133 /**
134 * Resolve the edition-aware default Booking Resources catalog view.
135 *
136 * Only a genuine first installation of Booking Calendar Free stores the
137 * Publishing default. Existing installations, paid editions, and malformed
138 * option values retain the established Overview default. Saved per-user
139 * catalog preferences continue to take precedence over this site default.
140 *
141 * @param bool $is_free_version Whether the active edition is Booking Calendar Free.
142 * @param string $stored_view Site default stored during initial activation.
143 *
144 * @return string The allow-listed default view identifier.
145 */
146 function wpbc_catalog_booking_resources_resolve_default_view( $is_free_version, $stored_view ) {
147 if ( ! $is_free_version ) {
148 return 'overview';
149 }
150
151 return 'publishing' === sanitize_key( (string) $stored_view ) ? 'publishing' : 'overview';
152 }
153
154 /**
155 * Return the current site's default Booking Resources catalog view.
156 *
157 * @return string The allow-listed default view identifier.
158 */
159 function wpbc_catalog_booking_resources_get_default_view() {
160 return wpbc_catalog_booking_resources_resolve_default_view(
161 ! class_exists( 'wpdev_bk_personal' ),
162 get_bk_option( 'booking_resources_catalog_default_view', '' )
163 );
164 }
165
166 /**
167 * Return the readable mechanics and template contract for this catalog.
168 *
169 * This domain configuration declares allow-lists and edition availability. It
170 * contains no SQL, rendered HTML, ownership queries, or mutation behavior.
171 *
172 * @return array<string,mixed> Booking Resources catalog configuration.
173 */
174 function wpbc_catalog_booking_resources_get_config() {
175 $column_config = wpbc_catalog_booking_resources_get_column_config();
176 $default_view = wpbc_catalog_booking_resources_get_default_view();
177 $display_views = array(
178 'overview' => array(
179 'label' => __( 'Overview', 'booking' ),
180 'fields' => array( 'resource', 'labels', 'capacity', 'price', 'actions', 'id' ),
181 ),
182 'publishing' => array(
183 'label' => __( 'Publishing', 'booking' ),
184 'fields' => array( 'resource', 'publishing', 'default_form', 'actions', 'id' ),
185 ),
186 );
187 if ( class_exists( 'wpdev_bk_biz_s' ) || class_exists( 'wpdev_bk_biz_m' ) || class_exists( 'wpdev_bk_biz_l' ) ) {
188 $display_views['booking_setup'] = array(
189 'label' => __( 'Booking setup', 'booking' ),
190 'fields' => array( 'resource', 'default_form', 'capacity', 'price', 'actions', 'id' ),
191 );
192 }
193 if ( class_exists( 'wpdev_bk_biz_l' ) ) {
194 $display_views['structure'] = array(
195 'label' => __( 'Structure', 'booking' ),
196 'fields' => array( 'resource', 'structure', 'priority', 'capacity', 'actions', 'id' ),
197 );
198 }
199 if ( isset( $column_config['definitions']['owner'] ) ) {
200 $display_views['ownership'] = array(
201 'label' => __( 'Ownership', 'booking' ),
202 'fields' => array( 'resource', 'owner', 'actions', 'id' ),
203 );
204 }
205 $display_views['all'] = array(
206 'label' => __( 'All fields', 'booking' ),
207 'fields' => $column_config['allowed'],
208 );
209 if ( 'publishing' === $default_view ) {
210 $column_config['default_visible'] = array_values(
211 array_intersect( $display_views['publishing']['fields'], $column_config['allowed'] )
212 );
213 }
214 $sorting_keys = array( 'id', 'title' );
215 if ( isset( $column_config['definitions']['capacity'] ) ) {
216 $sorting_keys[] = 'capacity';
217 }
218 if ( isset( $column_config['definitions']['priority'] ) ) {
219 $sorting_keys[] = 'priority';
220 }
221 if ( isset( $column_config['definitions']['price'] ) ) {
222 $sorting_keys[] = 'cost';
223 }
224
225 return array(
226 'id' => 'catalog_booking_resources',
227 'action' => 'WPBC_AJX_CATALOG_BOOKING_RESOURCES_LIST',
228 'nonce_name' => 'wpbc_catalog_booking_resources_nonce',
229
230 'items_per_page' => array(
231 'default' => 10,
232 'options' => array( 5, 10, 50, 100 ),
233 'maximum' => 100,
234 ),
235
236 'sorting' => array(
237 'default_key' => 'title',
238 'default_order' => 'asc',
239 'allowed_keys' => $sorting_keys,
240 ),
241
242 'columns' => $column_config,
243 'views' => array(
244 'default' => $default_view,
245 'definitions' => $display_views,
246 ),
247
248 'features' => array(
249 'inline_operations' => true,
250 'selection' => true,
251 'range_selection' => true,
252 'column_preferences' => true,
253 'column_order' => true,
254 'template_packs' => true,
255 'hierarchy' => true,
256 'expanded_details' => true,
257 'inspector' => true,
258 'bulk_operations' => class_exists( 'wpdev_bk_biz_s' ),
259 'delete_operations' => class_exists( 'wpdev_bk_personal' ),
260 'resource_filters' => class_exists( 'wpdev_bk_personal' ),
261 'resource_type_filter' => class_exists( 'wpdev_bk_biz_l' ),
262 ),
263 'hierarchy' => array(
264 'persistence' => 'global',
265 'preference_key' => 'hierarchy_state',
266 ),
267
268 'templates' => array(
269 'catalog' => 'wpbc-booking-resources-catalog',
270 'shell' => 'wpbc-ui-catalog-shell',
271 'items' => 'wpbc-booking-resources-table',
272 'filters' => 'wpbc-booking-resources-filters',
273 'toolbar' => 'wpbc-booking-resources-toolbar',
274 'header' => 'wpbc-booking-resources-header',
275 'row' => 'wpbc-booking-resource-row',
276 'parent_row' => 'wpbc-booking-resource-parent-row',
277 'child_row' => 'wpbc-booking-resource-child-row',
278 'row_cells' => 'wpbc-booking-resource-row-cells',
279 'child_summary' => 'wpbc-booking-resource-child-summary',
280 'labels' => 'wpbc-booking-resource-labels',
281 'price' => 'wpbc-booking-resource-price',
282 'details' => 'wpbc-booking-resource-details',
283 'details_content' => 'wpbc-booking-resource-details-content',
284 'empty' => 'wpbc-ui-catalog-empty',
285 'error' => 'wpbc-ui-catalog-error',
286 'pagination' => 'wpbc-booking-resources-pagination',
287 'action_menu' => 'wpbc-booking-resource-actions',
288 'inspector' => 'wpbc-ui-catalog-inspector-shell',
289 'inspector_create' => 'wpbc-booking-resource-inspector-create',
290 'inspector_edit' => 'wpbc-booking-resource-inspector-edit',
291 'inspector_group' => 'wpbc-booking-resource-inspector-group',
292 'inspector_field' => 'wpbc-booking-resource-inspector-field',
293 'inspector_publishing' => 'wpbc-booking-resource-inspector-publishing',
294 'inspector_published_pages' => 'wpbc-booking-resource-inspector-published-pages',
295 'inspector_bulk_edit' => 'wpbc-booking-resource-inspector-bulk-edit',
296 'inspector_bulk_group' => 'wpbc-booking-resource-inspector-bulk-group',
297 'inspector_bulk_field' => 'wpbc-booking-resource-inspector-bulk-field',
298 'inspector_bulk_review' => 'wpbc-booking-resource-inspector-bulk-review',
299 'inspector_delete' => 'wpbc-booking-resource-inspector-delete',
300 'inspector_capacity' => 'wpbc-booking-resource-inspector-capacity',
301 'inline_bar' => 'wpbc-booking-resources-inline-bar',
302 'inline_field' => 'wpbc-booking-resource-inline-field',
303 'inspector_inline_review' => 'wpbc-booking-resource-inspector-inline-review',
304 ),
305
306 'default_template_pack' => 'table',
307 'template_packs' => array(
308 'table' => array(
309 'catalog' => 'wpbc-booking-resources-catalog',
310 'items' => 'wpbc-booking-resources-table',
311 'filters' => 'wpbc-booking-resources-filters',
312 'toolbar' => 'wpbc-booking-resources-toolbar',
313 'header' => 'wpbc-booking-resources-header',
314 'row' => 'wpbc-booking-resource-row',
315 'parent_row' => 'wpbc-booking-resource-parent-row',
316 'child_row' => 'wpbc-booking-resource-child-row',
317 'row_cells' => 'wpbc-booking-resource-row-cells',
318 'child_summary' => 'wpbc-booking-resource-child-summary',
319 'labels' => 'wpbc-booking-resource-labels',
320 'price' => 'wpbc-booking-resource-price',
321 'action_menu' => 'wpbc-booking-resource-actions',
322 'pagination' => 'wpbc-booking-resources-pagination',
323 'details' => 'wpbc-booking-resource-details',
324 ),
325 'compact' => array(
326 'catalog' => 'wpbc-booking-resources-catalog',
327 'items' => 'wpbc-booking-resources-compact',
328 'filters' => 'wpbc-booking-resources-filters',
329 'toolbar' => 'wpbc-booking-resources-toolbar',
330 'header' => 'wpbc-booking-resources-header',
331 'row' => 'wpbc-booking-resource-row',
332 'parent_row' => 'wpbc-booking-resource-parent-row',
333 'child_row' => 'wpbc-booking-resource-child-row',
334 'row_cells' => 'wpbc-booking-resource-row-cells',
335 'child_summary' => 'wpbc-booking-resource-child-summary',
336 'labels' => 'wpbc-booking-resource-labels',
337 'price' => 'wpbc-booking-resource-price',
338 'action_menu' => 'wpbc-booking-resource-actions',
339 'pagination' => 'wpbc-booking-resources-pagination',
340 'details' => 'wpbc-booking-resource-details',
341 ),
342 'cards' => array(
343 'catalog' => 'wpbc-booking-resources-catalog',
344 'items' => 'wpbc-booking-resources-cards',
345 'filters' => 'wpbc-booking-resources-filters',
346 'toolbar' => 'wpbc-booking-resources-toolbar',
347 'header' => 'wpbc-booking-resources-cards-header',
348 'row' => 'wpbc-booking-resource-card',
349 'parent_row' => 'wpbc-booking-resource-parent-card',
350 'child_row' => 'wpbc-booking-resource-child-card',
351 'card_group' => 'wpbc-booking-resource-card-group',
352 'row_cells' => 'wpbc-booking-resource-card-fields',
353 'child_summary' => 'wpbc-booking-resource-child-summary-card',
354 'labels' => 'wpbc-booking-resource-labels',
355 'price' => 'wpbc-booking-resource-price',
356 'action_menu' => 'wpbc-booking-resource-actions',
357 'pagination' => 'wpbc-booking-resources-pagination',
358 'details' => 'wpbc-booking-resource-details-card',
359 ),
360 ),
361
362 'i18n' => array(
363 'catalog_label' => __( 'Booking resources catalog', 'booking' ),
364 'loading' => __( 'Loading', 'booking' ) . '...',
365 'empty_title' => __( 'No items found', 'booking' ),
366 'empty_message' => __( 'There are no items to display for this request.', 'booking' ),
367 'error_title' => __( 'Catalog unavailable', 'booking' ),
368 'error_message' => __( 'The catalog could not be loaded. Please refresh the page and try again.', 'booking' ),
369 'search_placeholder' => __( 'Search booking resources', 'booking' ),
370 'search_label' => __( 'Search booking resources', 'booking' ),
371 'search_clear' => __( 'Clear booking resource search', 'booking' ),
372 'resource_type_label' => __( 'Filter booking resources by type', 'booking' ),
373 'resource_type_all' => __( 'All resource types', 'booking' ),
374 'resource_type_single' => __( 'Resources', 'booking' ),
375 'resource_type_parent' => __( 'Parent resources', 'booking' ),
376 'resource_type_child' => __( 'Child resources', 'booking' ),
377 'view_label' => __( 'View', 'booking' ),
378 'layout_label' => __( 'Layout', 'booking' ),
379 'layout_table' => __( 'Default', 'booking' ),
380 'layout_compact' => __( 'Compact', 'booking' ),
381 'layout_cards' => __( 'Cards', 'booking' ),
382 'sort_resources' => __( 'Sort booking resources', 'booking' ),
383 'sort_by' => __( 'Sort by', 'booking' ),
384 'overview_view' => __( 'Overview', 'booking' ),
385 'custom_view' => __( 'Custom columns', 'booking' ),
386 'edit_rows' => __( 'Edit rows', 'booking' ),
387 'inline_editing_rows' => __( 'Editing rows', 'booking' ),
388 'inline_no_changes_yet' => __( 'No changes yet', 'booking' ),
389 'inline_help' => __( 'Edit safe fields on this page, then review all changes before applying them.', 'booking' ),
390 'inline_changed' => __( 'Changed', 'booking' ),
391 /* translators: %1$s: Number of changed rows. */
392 'inline_changed_row' => __( '%1$s changed row', 'booking' ),
393 /* translators: %1$s: Number of changed rows. */
394 'inline_changed_rows' => __( '%1$s changed rows', 'booking' ),
395 'inline_loading' => __( 'Preparing inline fields...', 'booking' ),
396 'inline_review_title' => __( 'Review inline changes', 'booking' ),
397 'inline_review_description' => __( 'Confirm the row-specific changes before applying them.', 'booking' ),
398 'inline_discard' => __( 'Discard all inline Booking Resource changes?', 'booking' ),
399 'inline_load_failed' => __( 'The inline Booking Resource fields could not be loaded.', 'booking' ),
400 'inline_review_failed' => __( 'The inline Booking Resource changes could not be reviewed.', 'booking' ),
401 'inline_apply_failed' => __( 'The inline Booking Resource changes could not be applied.', 'booking' ),
402 'selected_resources' => __( 'Selected resources:', 'booking' ),
403 'clear_selection' => __( 'Clear selection', 'booking' ),
404 'edit_selected' => __( 'Edit selected', 'booking' ),
405 'delete_selected' => __( 'Delete selected', 'booking' ),
406 'resource_selected' => __( 'resource selected', 'booking' ),
407 'resources_selected' => __( 'resources selected', 'booking' ),
408 'current' => __( 'Current', 'booking' ),
409 'operation' => __( 'operation', 'booking' ),
410 'new_value' => __( 'new value', 'booking' ),
411 'edit_booking_resources' => __( 'Edit Booking Resources', 'booking' ),
412 'delete_booking_resources' => __( 'Delete Booking Resources', 'booking' ),
413 'review_changes' => __( 'Review changes before applying', 'booking' ),
414 'review_changes_help' => __( 'No Booking Resource will change until you choose Apply changes.', 'booking' ),
415 'review_changes_button' => __( 'Review changes', 'booking' ),
416 'apply_changes' => __( 'Apply changes', 'booking' ),
417 'delete_review_help' => __( 'Review this permanent action before deleting the selected resources.', 'booking' ),
418 'resources_to_delete' => __( 'Resources to be permanently deleted', 'booking' ),
419 'delete_acknowledgement' => __( 'I understand that these Booking Resources will be permanently deleted.', 'booking' ),
420 'delete_warning' => __( 'This permanently removes the selected Booking Resources and their resource settings. This action cannot be undone.', 'booking' ),
421 'bookings_retained_warning' => __( 'Existing bookings are retained, but their deleted Booking Resources will no longer be available. Reassign or remove those bookings first if they must remain editable.', 'booking' ),
422 'bookings_retained' => __( 'bookings retained', 'booking' ),
423 'no_existing_bookings' => __( 'No existing bookings', 'booking' ),
424 'resource_id' => __( 'ID', 'booking' ),
425 'delete_resource' => __( 'Delete %1$s resource', 'booking' ),
426 'delete_resources' => __( 'Delete %1$s resources', 'booking' ),
427 'bulk_load_failed' => __( 'The selected Booking Resources could not be loaded.', 'booking' ),
428 'bulk_review_failed' => __( 'The proposed changes could not be reviewed.', 'booking' ),
429 'bulk_apply_failed' => __( 'The selected Booking Resources could not be updated.', 'booking' ),
430 'delete_load_failed' => __( 'The selected Booking Resources could not be reviewed for deletion.', 'booking' ),
431 'delete_apply_failed' => __( 'The selected Booking Resources could not be deleted.', 'booking' ),
432 'adjust_capacity' => __( 'Adjust capacity', 'booking' ),
433 'capacity_description' => __( 'Capacity controls how many unit calendars belong to this resource.', 'booking' ),
434 'current_capacity' => __( 'Current capacity', 'booking' ),
435 'set_new_capacity' => __( 'Set new capacity', 'booking' ),
436 'before' => __( 'Before', 'booking' ),
437 'after' => __( 'After', 'booking' ),
438 'units' => __( 'units', 'booking' ),
439 'preview_changes' => __( 'Preview changes', 'booking' ),
440 'keep_existing_unit' => __( 'Keep %1$s existing unit', 'booking' ),
441 'keep_existing_units' => __( 'Keep %1$s existing units', 'booking' ),
442 'keep_existing_help' => __( 'Existing unit calendars and their settings remain unchanged.', 'booking' ),
443 'create_new_unit' => __( 'Create %1$s new unit calendar', 'booking' ),
444 'create_new_units' => __( 'Create %1$s new unit calendars', 'booking' ),
445 'create_units_help' => __( 'New units inherit the parent resource owner, price, default form, photo, and description.', 'booking' ),
446 'select_units_to_detach' => __( 'Select units to make independent', 'booking' ),
447 'choose_detach_unit' => __( 'Choose %1$s unit to make independent', 'booking' ),
448 'choose_detach_units' => __( 'Choose %1$s units to make independent', 'booking' ),
449 'select_detach_help' => __( 'Selected units become independent Booking Resources. Their bookings and settings stay unchanged.', 'booking' ),
450 'make_independent' => __( 'Becomes independent', 'booking' ),
451 'decrease_outcome' => __( 'When capacity decreases', 'booking' ),
452 'detach_units' => __( 'Make selected units independent', 'booking' ),
453 'detach_units_help' => __( 'Keep the selected units, their settings, and their bookings as independent Booking Resources.', 'booking' ),
454 'delete_units' => __( 'Permanently delete selected units', 'booking' ),
455 'delete_units_help' => __( 'Permanently remove the selected child Booking Resources. Existing bookings are retained but lose their available Booking Resource.', 'booking' ),
456 'choose_delete_unit' => __( 'Choose %1$s unit to permanently delete', 'booking' ),
457 'choose_delete_units' => __( 'Choose %1$s units to permanently delete', 'booking' ),
458 'will_be_deleted' => __( 'Will be deleted', 'booking' ),
459 'units_to_delete' => __( 'Units to be permanently deleted', 'booking' ),
460 'capacity_delete_acknowledgement' => __( 'I understand that these child Booking Resources will be permanently deleted.', 'booking' ),
461 'capacity_delete_warning' => __( 'This permanently removes the selected child Booking Resources and their settings. This action cannot be undone.', 'booking' ),
462 'capacity_delete_bookings_warning' => __( 'Existing bookings are retained, but their deleted Booking Resources will no longer be available. Reassign or remove those bookings first if they must remain editable.', 'booking' ),
463 'review_capacity_change' => __( 'Review capacity change', 'booking' ),
464 'review_capacity_title' => __( 'Review capacity change', 'booking' ),
465 'review_capacity_help' => __( 'Confirm how the resource group will change.', 'booking' ),
466 'new_child_units' => __( 'New child units', 'booking' ),
467 'new_child_calendar' => __( 'New child calendar', 'booking' ),
468 'independent_units' => __( 'Independent units', 'booking' ),
469 'no_resources_deleted' => __( 'No Booking Resources or bookings will be deleted.', 'booking' ),
470 'independent_units_help' => __( 'Each independent unit keeps its title, availability, pricing, and bookings.', 'booking' ),
471 'back' => __( 'Back', 'booking' ),
472 'apply_capacity_change' => __( 'Apply capacity change', 'booking' ),
473 'capacity_load_failed' => __( 'The capacity editor could not be loaded.', 'booking' ),
474 'capacity_review_failed' => __( 'The capacity change could not be reviewed.', 'booking' ),
475 'capacity_apply_failed' => __( 'The capacity change could not be applied.', 'booking' ),
476 'selection_changed' => __( 'The catalog selection changed. Close this inspector and start again with the current selection.', 'booking' ),
477 'customize_columns' => __( 'Customize columns', 'booking' ),
478 'columns_legend' => __( 'Visible columns', 'booking' ),
479 'always_visible' => __( 'Always visible', 'booking' ),
480 'fixed_position' => __( 'Fixed position', 'booking' ),
481 'reset_order' => __( 'Reset column order', 'booking' ),
482 'reset_preferences' => __( 'Reset to default', 'booking' ),
483 'close_columns' => __( 'Close column settings', 'booking' ),
484 /* translators: %1$s: Catalog column label. */
485 'move_column' => __( 'Move %1$s column', 'booking' ),
486 'column_moved' => __( 'Column moved.', 'booking' ),
487 'show' => __( 'Show', 'booking' ),
488 'per_page' => __( 'per page', 'booking' ),
489 'page_number' => __( 'Page number', 'booking' ),
490 'no_description' => __( 'No description', 'booking' ),
491 /* translators: 1: Booking Resource title. 2: Booking Resource description. */
492 'thumbnail_tooltip' => __( 'Title: %1$s — Description: %2$s', 'booking' ),
493 'parent_label' => __( 'Parent', 'booking' ),
494 'child_label' => __( 'Child', 'booking' ),
495 'independent_label' => __( 'Independent', 'booking' ),
496 /* translators: 1: Parent label. 2: Number of child Resources. */
497 'parent_child_label' => __( '%1$s · %2$s child', 'booking' ),
498 /* translators: 1: Parent label. 2: Number of child Resources. */
499 'parent_children_label' => __( '%1$s · %2$s children', 'booking' ),
500 /* translators: 1: Parent Booking Resource title. 2: Number of child Resources. */
501 'children_of_count' => __( 'Children of %1$s (%2$s)', 'booking' ),
502 /* translators: %1$s: Parent Booking Resource title. */
503 'children_belong_to' => __( 'Units that belong to %1$s.', 'booking' ),
504 /* translators: %1$s: Parent Booking Resource title. */
505 'child_of' => __( 'Child of %1$s', 'booking' ),
506 'column_resource' => __( 'Booking Resource', 'booking' ),
507 'column_labels' => __( 'Labels', 'booking' ),
508 'column_capacity' => __( 'Capacity', 'booking' ),
509 'column_price' => __( 'Price', 'booking' ),
510 'column_actions' => __( 'Actions', 'booking' ),
511 'column_id' => __( 'ID', 'booking' ),
512 'select_all' => __( 'Select all visible booking resources', 'booking' ),
513 /* translators: %s: Booking Resource title. */
514 'select_resource' => __( 'Select booking resource %s', 'booking' ),
515 'expand_all' => __( 'Expand all child resources', 'booking' ),
516 'collapse_all' => __( 'Collapse all child resources', 'booking' ),
517 'expand_children' => __( 'Show child resources', 'booking' ),
518 'collapse_children' => __( 'Hide child resources', 'booking' ),
519 /* translators: %1$s: Number of child Booking Resources. */
520 'child_count_singular' => __( '%1$s child resource', 'booking' ),
521 /* translators: %1$s: Number of child Booking Resources. */
522 'child_count_plural' => __( '%1$s child resources', 'booking' ),
523 /* translators: %1$s: Parent Booking Resource title. */
524 'expand_children_for' => __( 'Show child resources for %1$s', 'booking' ),
525 /* translators: %1$s: Parent Booking Resource title. */
526 'collapse_children_for' => __( 'Hide child resources for %1$s', 'booking' ),
527 'show_details' => __( 'Show resource details', 'booking' ),
528 'hide_details' => __( 'Hide resource details', 'booking' ),
529 'details_loading' => __( 'Loading', 'booking' ) . '...',
530 'details_load_failed' => __( 'The Booking Resource details could not be loaded. Please try again.', 'booking' ),
531 'inspector_empty_title' => __( 'Edit a Booking Resource', 'booking' ),
532 'inspector_empty_message' => __( 'Select a Booking Resource row or choose Edit to open its settings.', 'booking' ),
533 'inspector_loading' => __( 'Loading', 'booking' ) . '...',
534 'inspector_load_failed' => __( 'The Booking Resource editor could not be loaded.', 'booking' ),
535 'inspector_save_failed' => __( 'The Booking Resource could not be saved.', 'booking' ),
536 'inspector_discard' => __( 'Discard unsaved Booking Resource changes?', 'booking' ),
537 'create_unavailable' => __( 'The Booking Resource limit for this account has been reached.', 'booking' ),
538 'select_image_title' => __( 'Select Booking Resource Image', 'booking' ),
539 'use_image' => __( 'Use this image', 'booking' ),
540 'select_image' => __( 'Select image', 'booking' ),
541 'remove_image' => __( 'Remove', 'booking' ),
542 'demo_image_change_unavailable' => __( 'Changing the Booking Resource image is not allowed in demo versions.', 'booking' ),
543 'demo_image_change_unavailable_title' => __( 'Booking Resource image', 'booking' ),
544 'cancel' => __( 'Cancel', 'booking' ),
545 'save_changes' => __( 'Save changes', 'booking' ),
546 'add_resource' => __( 'Add resource', 'booking' ),
547 'shortcode_copied' => __( 'Shortcode copied.', 'booking' ),
548 'shortcode_copy_failed' => __( 'The shortcode could not be copied.', 'booking' ),
549 'no_labels' => __( 'No labels', 'booking' ),
550 'no_actions' => __( 'No actions available', 'booking' ),
551 'price_unavailable' => __( 'Price is not available', 'booking' ),
552 /* translators: %1$s: Booking Resource title. */
553 'actions_for' => __(
554 'Actions for %1$s',
555 'booking'
556 ),
557 'pagination_label' => __( 'Booking Resources pagination', 'booking' ),
558 'previous_page' => __( 'Previous page', 'booking' ),
559 'next_page' => __( 'Next page', 'booking' ),
560 /* translators: 1: Current page number. 2: Total page count. */
561 'page_status' => __(
562 'Page %1$s of %2$s',
563 'booking'
564 ),
565 /* translators: 1: First result number. 2: Last result number. 3: Total result count. */
566 'results_status' => __(
567 'Showing %1$s to %2$s of %3$s',
568 'booking'
569 ),
570 ),
571 );
572 }
573
574 /**
575 * Register the catalog mechanics, independent provider, and WP templates.
576 *
577 * @return true|WP_Error Registration result.
578 */
579 function wpbc_catalog_booking_resources_register_catalog() {
580 static $registration_result = null;
581
582 if ( null !== $registration_result ) {
583 return $registration_result;
584 }
585
586 $registration_result = WPBC_UI_Catalog_Registry::get_instance()->register(
587 wpbc_catalog_booking_resources_get_config(),
588 new WPBC_Catalog_Booking_Resources_Provider(),
589 array(
590 'wpbc-booking-resources-catalog' => __DIR__ . '/templates/booking-resources-wptpl.php',
591 'wpbc-booking-resources-table' => __DIR__ . '/templates/catalog-table-wptpl.php',
592 'wpbc-booking-resources-compact' => __DIR__ . '/templates/catalog-compact-wptpl.php',
593 'wpbc-booking-resources-cards' => __DIR__ . '/templates/catalog-cards-wptpl.php',
594 'wpbc-booking-resources-cards-header' => __DIR__ . '/templates/catalog-cards-header-wptpl.php',
595 'wpbc-booking-resources-filters' => __DIR__ . '/templates/catalog-filters-wptpl.php',
596 'wpbc-booking-resources-toolbar' => __DIR__ . '/templates/catalog-toolbar-wptpl.php',
597 'wpbc-booking-resources-header' => __DIR__ . '/templates/catalog-header-wptpl.php',
598 'wpbc-booking-resource-row' => __DIR__ . '/templates/resource-row-wptpl.php',
599 'wpbc-booking-resource-parent-row' => __DIR__ . '/templates/resource-parent-row-wptpl.php',
600 'wpbc-booking-resource-child-row' => __DIR__ . '/templates/resource-child-row-wptpl.php',
601 'wpbc-booking-resource-row-cells' => __DIR__ . '/templates/resource-row-cells-wptpl.php',
602 'wpbc-booking-resource-child-summary' => __DIR__ . '/templates/resource-child-summary-wptpl.php',
603 'wpbc-booking-resource-card' => __DIR__ . '/templates/resource-card-wptpl.php',
604 'wpbc-booking-resource-parent-card' => __DIR__ . '/templates/resource-parent-card-wptpl.php',
605 'wpbc-booking-resource-child-card' => __DIR__ . '/templates/resource-child-card-wptpl.php',
606 'wpbc-booking-resource-card-group' => __DIR__ . '/templates/resource-card-group-wptpl.php',
607 'wpbc-booking-resource-card-fields' => __DIR__ . '/templates/resource-card-fields-wptpl.php',
608 'wpbc-booking-resource-child-summary-card' => __DIR__ . '/templates/resource-child-summary-card-wptpl.php',
609 'wpbc-booking-resource-labels' => __DIR__ . '/templates/resource-labels-wptpl.php',
610 'wpbc-booking-resource-price' => __DIR__ . '/templates/resource-price-wptpl.php',
611 'wpbc-booking-resource-actions' => __DIR__ . '/templates/resource-actions-wptpl.php',
612 'wpbc-booking-resource-details' => __DIR__ . '/templates/resource-details-wptpl.php',
613 'wpbc-booking-resource-details-card' => __DIR__ . '/templates/resource-details-card-wptpl.php',
614 'wpbc-booking-resource-details-content' => __DIR__ . '/templates/resource-details-content-wptpl.php',
615 'wpbc-booking-resource-inspector-create' => __DIR__ . '/templates/resource-inspector-create-wptpl.php',
616 'wpbc-booking-resource-inspector-edit' => __DIR__ . '/templates/resource-inspector-edit-wptpl.php',
617 'wpbc-booking-resource-inspector-group' => __DIR__ . '/templates/resource-inspector-group-wptpl.php',
618 'wpbc-booking-resource-inspector-field' => __DIR__ . '/templates/resource-inspector-field-wptpl.php',
619 'wpbc-booking-resource-inspector-publishing' => __DIR__ . '/templates/resource-inspector-publishing-wptpl.php',
620 'wpbc-booking-resource-inspector-published-pages' => __DIR__ . '/templates/resource-inspector-published-pages-wptpl.php',
621 'wpbc-booking-resource-inspector-bulk-edit' => __DIR__ . '/templates/resource-inspector-bulk-edit-wptpl.php',
622 'wpbc-booking-resource-inspector-bulk-group' => __DIR__ . '/templates/resource-inspector-bulk-group-wptpl.php',
623 'wpbc-booking-resource-inspector-bulk-field' => __DIR__ . '/templates/resource-inspector-bulk-field-wptpl.php',
624 'wpbc-booking-resource-inspector-bulk-review' => __DIR__ . '/templates/resource-inspector-bulk-review-wptpl.php',
625 'wpbc-booking-resource-inspector-delete' => __DIR__ . '/templates/resource-inspector-delete-wptpl.php',
626 'wpbc-booking-resource-inspector-capacity' => __DIR__ . '/templates/resource-inspector-capacity-wptpl.php',
627 'wpbc-booking-resources-inline-bar' => __DIR__ . '/templates/catalog-inline-bar-wptpl.php',
628 'wpbc-booking-resource-inline-field' => __DIR__ . '/templates/resource-inline-field-wptpl.php',
629 'wpbc-booking-resource-inspector-inline-review' => __DIR__ . '/templates/resource-inspector-inline-review-wptpl.php',
630 'wpbc-booking-resources-pagination' => __DIR__ . '/templates/catalog-pagination-wptpl.php',
631 )
632 );
633
634 return $registration_result;
635 }
636