Architecture
Developer reference: This section is for theme and plugin developers extending Booking Engine Connector.
Reference diagrams use Mermaid. PHP namespaces live under BookingEngineConnector\.
Overview
The plugin:
- Loads the PSR-4 autoloader (
includes/), definesBEC_*constants, runsbootstrap.php(database migrations), thenPlugin::instance()->init(). - On activation: incremental migrations, default options (sync interval, fallback/checkout defaults), schedules WP-Cron.
- On
plugins_loaded: template helpers, text domain, registration of search/front/admin/sync/CPT/field registries/shortcodes/Elementor query hook.
Elementor Pro (Loop Grid)
BookingEngineConnector\Elementor\AvailabilityQueryFilter registers Elementor’s action elementor/query/{query_id} for each id returned by bec_elementor_unit_filter_query_ids (defaults bec_available_only and alias bec_filtered_units). The primary query id is overridable via bec_elementor_availability_query_id. It narrows the Loop Grid using QuoteService::getQuote(), SearchContext, and optional bec_filter_* GET params from [bec_unit_filters].
Developer filters: bec_elementor_availability_query_id, bec_elementor_unit_filter_query_ids, bec_elementor_available_post_ids, bec_elementor_availability_max_units.
User-facing setup: Elementor — hide units with no availability.
Bootstrap & module registration
Layered architecture
Sync sequence
Front flow — query string → quote → CTA or fallback
URL parameters include bec_checkin, bec_checkout, optional occupancy keys (See SearchContext).
Shortcodes reuse the same services (SearchForm, CheckoutUrlService, QuoteService, etc.).
REST API, blocks, and webhooks
- No custom public REST API is registered for booking operations (
register_rest_routeis unused for BEC’s own endpoints). Thebec_unitCPT participates in WordPress core post REST where configured; sensitive meta such asbec_sync_payloadis withheld from REST. - No Gutenberg blocks ship with the plugin PHP (
register_block_typeis not used) — use shortcodes or theme integration. - No inbound webhooks — inventory is pulled on sync (WP-Cron + admin actions) and quotes are requested on demand.
Admin-only integration points include wp_ajax_* handlers (sync progress + batched steps) and admin_post_* actions documented for developers in Sync hooks & filters.
Kross provider internals
Directory mind map
Concept map
| Area | Responsibility |
|---|---|
| Remote inventory | ProviderInterface::fetchRemoteUnits() |
| Persisted posts/meta | SyncService + canonical core fields + optional mapped meta |
| Booking context | SearchContext built from bec_* query args |
| Listing filters | UnitFilterRegistry, UnitFilterQueryApplier, [bec_unit_filters] GET params |
| Extensibility | Filters/actions prefixed bec_* |