(#3) - templating

This commit was merged in pull request #9.
This commit is contained in:
Martin Slachta
2026-06-14 07:16:13 +02:00
parent f4d3972d07
commit 7d7f748f7a
31 changed files with 661 additions and 126 deletions
+14 -1
View File
@@ -1,4 +1,8 @@
<?php
use Reservair\Templating\Elements\RsvReservationSummaryElement;
use Reservair\Templating\Elements\RsvReservationActionsElement;
use Reservair\Templating\Elements\RsvResetFormButtonElement;
/**
* Plugin Name: Reservair
* Description: A reservation and booking system for WordPress. Site visitors browse available time slots and submit reservation requests via a Gutenberg block; administrators manage timetables, services, forms, and reservations from the WordPress admin panel.
@@ -29,7 +33,7 @@ register_activation_hook( __FILE__, [ 'RsvInstaller', 'install' ] );
* plugins we might interact with) is fully loaded.
*/
function rsv_bootstrap(): void {
global $rsv_form_registry;
global $rsv_form_registry, $rsv_template_registry;
// Re-grant the custom capability after a plugin *update* (the activation hook
// only runs on activate). No-op once the stored version matches.
@@ -47,6 +51,15 @@ function rsv_bootstrap(): void {
$rsv_form_registry->register( 'button', new RsvButtonElementHandler() );
$rsv_form_registry->register( 'reservation', new RsvFormReservationElementHandler() );
$rsv_form_registry->register( 'output-reservation-summary', new RsvReservationSummaryElementHandler() );
// Template custom-element registry. Extensions register via the action.
add_action( 'rsv-template-register-custom-elements', function ( \Reservair\Templating\RsvTemplateRegistry $reg ): void {
$reg->register( 'reservation-summary', new RsvReservationSummaryElement() );
$reg->register( 'reservation-actions', new RsvReservationActionsElement() );
$reg->register( 'reset-form-button', new RsvResetFormButtonElement() );
} );
$rsv_template_registry = new \Reservair\Templating\RsvTemplateRegistry();
do_action( 'rsv-template-register-custom-elements', $rsv_template_registry );
}
add_action( 'plugins_loaded', 'rsv_bootstrap' );