Skip to main content

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:

  1. Loads the PSR-4 autoloader (includes/), defines BEC_* constants, runs bootstrap.php (database migrations), then Plugin::instance()->init().
  2. On activation: incremental migrations, default options (sync interval, fallback/checkout defaults), schedules WP-Cron.
  3. 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_route is unused for BEC’s own endpoints). The bec_unit CPT participates in WordPress core post REST where configured; sensitive meta such as bec_sync_payload is withheld from REST.
  • No Gutenberg blocks ship with the plugin PHP (register_block_type is 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

AreaResponsibility
Remote inventoryProviderInterface::fetchRemoteUnits()
Persisted posts/metaSyncService + canonical core fields + optional mapped meta
Booking contextSearchContext built from bec_* query args
Listing filtersUnitFilterRegistry, UnitFilterQueryApplier, [bec_unit_filters] GET params
ExtensibilityFilters/actions prefixed bec_*