From ccf5e61a075c35d24befc175994b5cb8957ca322 Mon Sep 17 00:00:00 2001
From: Jake Vanderwerf <get@jakevanderwerf.ca>
Date: Wed, 26 Aug 2026 21:45:53 +0000
Subject: [PATCH] =Extra JVB() calls replaced, minor tweaks
---
src/forms/render.php | 54 +++---------------------------------------------------
1 files changed, 3 insertions(+), 51 deletions(-)
diff --git a/src/forms/render.php b/src/forms/render.php
index 9865bf3..14a5bb2 100644
--- a/src/forms/render.php
+++ b/src/forms/render.php
@@ -1,55 +1,7 @@
<?php
+
+use JVBase\meta\Form;
+
if (!defined('ABSPATH')) {
exit; // Exit if accessed directly
}
-/**
- * Form Block Render
- *
- * @package Edmonton_Ink
- */
-
-/**
- * Renders the form block on the frontend
- *
- * @param array $attributes The block attributes.
- * @param string $content The block content.
- * @param WP_Block $block The block instance.
- * @return string The rendered output.
- */
-function jvbRenderFormBlock(array $attributes, string $content, WP_Block $block):string
-{
- // Get form type from attributes
- $form_type = isset($attributes['formType']) ? $attributes['formType'] : '';
-
- // If no form type selected, return a message
- if (empty($form_type)) {
- return '<div class="jvb-form-error">No form type selected. Please edit this block and select a form type.</div>';
- }
-
- // Get other attributes
- $show_labels = isset($attributes['showLabels']) ? $attributes['showLabels'] : true;
- $custom_email_to = isset($attributes['customEmailTo']) ? $attributes['customEmailTo'] : '';
-
- // Set custom options for the form
- $form_options = array();
-
- // Set custom email recipient if provided
- if (!empty($custom_email_to)) {
- $form_options['email_to'] = $custom_email_to;
- }
-
- // Render the form with the specified options
- $form_output = JVB()->forms()->renderForm($form_type);
-
- // Get block classes
- $wrapper_attributes = get_block_wrapper_attributes([
- 'class' => 'jvb-forms'
- ]);
-
- // Return the wrapped form
- return sprintf(
- '<div %1$s>%2$s</div>',
- $wrapper_attributes,
- $form_output
- );
-}
--
Gitblit v1.10.0