From a58a2e7ca4700d3e23341fde767060a4c2c704a3 Mon Sep 17 00:00:00 2001
From: Jake Vanderwerf <get@jakevanderwerf.ca>
Date: Sun, 30 Aug 2026 21:04:37 +0000
Subject: [PATCH] =Minor tweaks to MenuBlock.php

---
 inc/blocks/FormBlock.php |   21 +++++++++------------
 1 files changed, 9 insertions(+), 12 deletions(-)

diff --git a/inc/blocks/FormBlock.php b/inc/blocks/FormBlock.php
index c34fee8..9aa7c30 100644
--- a/inc/blocks/FormBlock.php
+++ b/inc/blocks/FormBlock.php
@@ -1,6 +1,7 @@
 <?php
 namespace JVBase\blocks;
 
+use JVBase\integrations\services\Cloudflare;
 use JVBase\managers\Cache;
 use JVBase\meta\Form;
 use JVBase\base\Site;
@@ -33,11 +34,9 @@
 
 	public function __construct()
 	{
-		$this->cache = Cache::for('forms', WEEK_IN_SECONDS);
+		$this->cache = Cache::for('forms', null, WEEK_IN_SECONDS);
 
-		if (JVB_TESTING) {
-			$this->cache->flush();
-		}
+
 		// Initialize forms from filter
 		$this->forms = $this->registerForms();
 		$this->form_contact = apply_filters('jvb_form_contact', '');
@@ -63,7 +62,7 @@
 
 		// Enqueue Turnstile if needed
 		if (Site::hasIntegration('cloudflare')) {
-			$cloudflare = JVB()->connect('cloudflare');
+			$cloudflare = Cloudflare::getInstance();
 			if ($cloudflare->isSetUp()) {
 				$cloudflare->enqueueTurnstileScripts();
 			}
@@ -92,10 +91,9 @@
 		$forms = apply_filters('jvb_register_forms', $default_forms);
 
 		// Process forms to ensure they have proper structure
-		$processed_forms = [];
-		foreach ($forms as $form_key => $form_config) {
-			$processed_forms[$form_key] = $this->processFormConfig($form_config);
-		}
+		$processed_forms = array_map(function ($form_config) {
+			return $this->processFormConfig($form_config);
+		}, $forms);
 
 		return $processed_forms;
 	}
@@ -131,9 +129,8 @@
 			return '<div class="jvb-form-error">No valid form type selected. Please edit this block and select a form type.</div>';
 		}
 
-		$cache_key = $this->cache->generateKey($block);
 		return $this->cache->remember(
-			$cache_key,
+			$block,
 			function() use ($form_type, $block) {
 				return $this->renderForm($form_type, $block);
 			}
@@ -409,7 +406,7 @@
 			return;
 		}
 
-		$cloudflare = JVB()->connect('cloudflare');
+		$cloudflare = Cloudflare::getInstance();
 		if ($cloudflare->isSetUp()) {
 			$cloudflare->renderTurnstile();
 		}

--
Gitblit v1.10.0