' . esc_html($success_message) . '
'; + echo 'diff --git a/includes/class-hvac-event-form-builder.php b/includes/class-hvac-event-form-builder.php index 1d86a626..88317aa6 100644 --- a/includes/class-hvac-event-form-builder.php +++ b/includes/class-hvac-event-form-builder.php @@ -125,8 +125,8 @@ class HVAC_Event_Form_Builder extends HVAC_Form_Builder { $this->template_manager = HVAC_Event_Template_Manager::instance(); $this->template_mode_enabled = $enable_templates; - // Initialize cache if available (not implemented yet) - // $this->cache = class_exists('HVAC_Event_Cache') ? HVAC_Event_Cache::instance() : null; + // Initialize cache if available + $this->cache = class_exists('HVAC_Event_Cache') ? HVAC_Event_Cache::instance() : null; $this->init_event_form_hooks(); } @@ -506,7 +506,7 @@ class HVAC_Event_Form_Builder extends HVAC_Form_Builder { */ private function get_timezone_options(): array { // Check cache first - $cached_timezones = $this->cache->get_timezone_list(); + $cached_timezones = $this->cache ? $this->cache->get_timezone_list() : false; if ($cached_timezones !== false) { return $cached_timezones; @@ -523,7 +523,9 @@ class HVAC_Event_Form_Builder extends HVAC_Form_Builder { } // Cache the results - $this->cache->cache_timezone_list($timezone_options); + if ($this->cache) { + $this->cache->cache_timezone_list($timezone_options); + } return $timezone_options; } @@ -536,7 +538,7 @@ class HVAC_Event_Form_Builder extends HVAC_Form_Builder { private function get_venue_options(): array { // Check cache first $cache_key = 'venue_options_' . get_current_user_id(); - $cached_venues = $this->cache->get_venue_search($cache_key); + $cached_venues = $this->cache ? $this->cache->get_venue_search($cache_key) : false; if ($cached_venues !== false) { return $cached_venues; @@ -566,7 +568,9 @@ class HVAC_Event_Form_Builder extends HVAC_Form_Builder { } // Cache the results - $this->cache->cache_venue_search($cache_key, $venue_options); + if ($this->cache) { + $this->cache->cache_venue_search($cache_key, $venue_options); + } return $venue_options; } diff --git a/includes/class-hvac-form-builder.php b/includes/class-hvac-form-builder.php index af9bb9de..c4cf5925 100644 --- a/includes/class-hvac-form-builder.php +++ b/includes/class-hvac-form-builder.php @@ -26,28 +26,28 @@ class HVAC_Form_Builder { * * @var array */ - private array $fields = []; + protected array $fields = []; /** * Form attributes * * @var array */ - private array $form_attrs = []; + protected array $form_attrs = []; /** * Form errors * * @var array */ - private array $errors = []; + protected array $errors = []; /** * Form data * * @var array */ - private array $data = []; + protected array $data = []; /** * Constructor with promoted property. @@ -55,7 +55,7 @@ class HVAC_Form_Builder { * @param string $nonce_action Nonce action for the form */ public function __construct( - private string $nonce_action + protected string $nonce_action ) { $this->set_default_attributes(); } @@ -168,7 +168,7 @@ class HVAC_Form_Builder { * * @return string */ - private function get_form_attributes(): string { + protected function get_form_attributes(): string { $attrs = []; foreach ( $this->form_attrs as $key => $value ) { if ( ! empty( $value ) ) { @@ -184,7 +184,7 @@ class HVAC_Form_Builder { * @param array $field Field configuration * @return string */ - private function render_field( $field ) { + protected function render_field( $field ) { $output = sprintf( '
' . esc_html($success_message) . '
'; + echo '