From 46d681c6b825d21b3f698d793c4e630c687d90ad Mon Sep 17 00:00:00 2001
From: Jake Vanderwerf <get@jakevanderwerf.ca>
Date: Thu, 21 May 2026 21:41:53 +0000
Subject: [PATCH] =Major CustomBlocks.php overhaul, expanding block support and customization from the editor. theme.json should now be updated on new themes to set brand colours, etc. Also note: major change to .col vs .row alignment: simplifying it to .top .bottom vs the confusion of the differences for .col/.row .start and .a-start

---
 inc/blocks/FormBlock.php |   28 +++++++++++-----------------
 1 files changed, 11 insertions(+), 17 deletions(-)

diff --git a/inc/blocks/FormBlock.php b/inc/blocks/FormBlock.php
index 3e8a892..0d447da 100644
--- a/inc/blocks/FormBlock.php
+++ b/inc/blocks/FormBlock.php
@@ -2,11 +2,8 @@
 namespace JVBase\blocks;
 
 use JVBase\managers\Cache;
-use JVBase\meta\MetaManager;
-use JVBase\managers\CloudflareTurnstile;
-use Exception;
-use JVBase\utility\Features;
-use WP_Block;
+use JVBase\meta\Form;
+use JVBase\base\Site;
 
 if (!defined('ABSPATH')) {
 	exit; // Exit if accessed directly
@@ -37,6 +34,7 @@
 	public function __construct()
 	{
 		$this->cache = Cache::for('forms', WEEK_IN_SECONDS);
+
 		// Initialize forms from filter
 		$this->forms = $this->registerForms();
 		$this->form_contact = apply_filters('jvb_form_contact', '');
@@ -61,7 +59,7 @@
 		}
 
 		// Enqueue Turnstile if needed
-		if (Features::forSite()->hasIntegration('cloudflare')) {
+		if (Site::hasIntegration('cloudflare')) {
 			$cloudflare = JVB()->connect('cloudflare');
 			if ($cloudflare->isSetUp()) {
 				$cloudflare->enqueueTurnstileScripts();
@@ -181,7 +179,6 @@
 		$this->renderTurnstile();
 		$this->renderFormEnd($type, $form_id);
 		echo '</div>';
-
 		return ob_get_clean();
 	}
 
@@ -294,17 +291,14 @@
 			return;
 		}
 
-		// Create MetaManager instance for form rendering
-		$meta = new MetaManager();
-
 		// If sections are defined, render in sections
 		if (!empty($form_config['sections'])) {
-			$this->renderSections($type, $meta);
+			$this->renderSections($type);
 		} else {
 			echo jvbFormStatus();
 			// Render fields directly
 			foreach ($form_config['fields'] as $field_name => $field_config) {
-				$meta->render('form', $field_name, $field_config);
+				echo Form::render($field_name, null, $field_config);
 			}
 			$submit_text = $form_config['submit'] ?? 'Submit';
 			echo '<button type="submit" class="button primary">' . esc_html($submit_text) . '</button>';
@@ -314,7 +308,7 @@
 	/**
 	 * Render form sections
 	 */
-	protected function renderSections(string $type, MetaManager $meta): void
+	protected function renderSections(string $type): void
 	{
 		$form_config = $this->forms[$type];
 		$sections = $form_config['sections'];
@@ -330,7 +324,7 @@
 
 		// Render navigation if multiple sections
 		if (count($sections) > 1) {
-			echo '<nav class="tabs row start" role="tablist">';
+			echo '<nav class="tabs row left" role="tablist">';
 			$i = 1;
 			foreach ($sections as $slug => $section) {
 				$active_class = $i === 1 ? ' active' : '';
@@ -369,11 +363,11 @@
 			});
 
 			foreach ($section_fields as $field_name => $field_config) {
-				$meta->render('form', $field_name, $field_config);
+				echo Form::render($field_name, null, $field_config);
 			}
 
 			// Add step navigation buttons
-			echo '<div class="step-navigation row btw">';
+			echo '<div class="step-navigation row x-btw">';
 
 			if ($i > 0) {
 				echo '<button type="button" class="button secondary prev-step" data-action="prev-step">';
@@ -408,7 +402,7 @@
 	 */
 	protected function renderTurnstile(): void
 	{
-		if (!Features::hasIntegration('cloudflare')) {
+		if (!Site::hasIntegration('cloudflare')) {
 			return;
 		}
 

--
Gitblit v1.10.0