From ad052f72a6c994dfb2fe0aa11970c9d110564004 Mon Sep 17 00:00:00 2001
From: Jake Vanderwerf <get@jakevanderwerf.ca>
Date: Tue, 10 Feb 2026 17:50:45 +0000
Subject: [PATCH] =Fix for FAQpage schema not outputting correctly, as well as Form.php status radios and editForm on CRUDSkeleton.php
---
inc/meta/Form.php | 49 ++++++++++++++++++++++++++++++++++---------------
1 files changed, 34 insertions(+), 15 deletions(-)
diff --git a/inc/meta/Form.php b/inc/meta/Form.php
index 2ad8dc9..e5725b0 100644
--- a/inc/meta/Form.php
+++ b/inc/meta/Form.php
@@ -107,6 +107,8 @@
$output .= static::buildLabel($name, $config);
if (!array_key_exists('skipInput', $config)) {
$output .= static::buildInput($content);
+ } else {
+ $output .= $content;
}
$output .= static::buildHint($config);
@@ -570,30 +572,47 @@
protected static function renderRadio(string $name, mixed $value, array $config): string
{
- $options = $config['options'] ?? [];
+ $options = $config['options'] ?? [];
+ $inputClass = !empty($config['inputClass']) ? ' class="' . esc_attr($config['inputClass']) . '"' : '';
+ $idPrefix = $config['idPrefix'] ?? '';
$radios = sprintf(
'<fieldset>
- <legend>%s%s</legend>',
+ <legend>%s%s</legend>',
array_key_exists('label', $config) ? esc_html($config['label']) : 'Select an option',
- array_key_exists('required', $config) && $config['required']===true ? '<span class="required" aria-label="required">*</span>' : ''
+ array_key_exists('required', $config) && $config['required'] === true
+ ? '<span class="required" aria-label="required">*</span>' : ''
);
- foreach ($options as $optValue => $optLabel) {
+ foreach ($options as $optValue => $optConfig) {
+ if (is_array($optConfig)) {
+ $optLabel = $optConfig['label'] ?? $optValue;
+ $optIcon = $optConfig['icon'] ?? null;
+ $optDisabled = !empty($optConfig['disabled']) ? ' disabled' : '';
+ } else {
+ $optLabel = $optConfig;
+ $optIcon = null;
+ $optDisabled = '';
+ }
+
+ $labelContent = $optIcon
+ ? jvbDashIcon($optIcon)
+ : '<span>' . esc_html($optLabel) . '</span>';
+
+ $optId = esc_attr($idPrefix . $name . '-' . $optValue);
+
$radios .= sprintf(
- '
- <input type="radio" name="%s" id="%s-%s" value="%s"%s />
- <label class="radio-option" for="%s-%s">
- <span>%s</span>
- </label>',
+ '<input type="radio" name="%s" id="%s" value="%s"%s%s%s />
+ <label class="radio-option" for="%s" title="%s">%s</label>',
esc_attr($name),
- esc_attr($name),
- $optValue,
+ $optId,
esc_attr($optValue),
- checked($value, $optValue,false),
- esc_attr($name),
- $optValue,
- esc_html($optLabel)
+ checked($value, $optValue, false),
+ $optDisabled,
+ $inputClass,
+ $optId,
+ esc_html($optLabel),
+ $labelContent
);
}
--
Gitblit v1.10.0