From f4be611c51473359e6d41780f0313c446079e9d3 Mon Sep 17 00:00:00 2001
From: Jake Vanderwerf <get@jakevanderwerf.ca>
Date: Tue, 09 Jun 2026 15:19:24 +0000
Subject: [PATCH] =Switched the /base/options.php to the same pattern as Site.php: a class based approached rather than a filter. Updated Meta.php to play along with the defined fields from there in Meta::forOptions. Had to change openingHoursSpecificationsTrait.php to not use the translater functions __('text','textdomain') for now, as we load before init.
---
inc/meta/Form.php | 9 +++++----
1 files changed, 5 insertions(+), 4 deletions(-)
diff --git a/inc/meta/Form.php b/inc/meta/Form.php
index 8b7b414..868abf9 100644
--- a/inc/meta/Form.php
+++ b/inc/meta/Form.php
@@ -53,7 +53,7 @@
/**
* Render complete form from Meta instance
*/
- public static function renderFormFrom(Meta $meta, string $endpoint, array $options = []): string
+ public static function renderFormFrom(Meta $meta, string $endpoint, array $options = [], array $fields = []): string
{
$id = $options['form-id'] ?? $endpoint;
$classes = isset($options['classes']) ? ' class="' . implode(' ', $options['classes']) . '"' : '';
@@ -70,9 +70,10 @@
$output .= '<p>' . esc_html($d) . '</p>';
}
}
-
- foreach ($meta->configs() as $name => $config) {
- $output .= static::render($name, $meta->get($name), $config);
+ $allFields = $meta->getAll($fields);
+ foreach ($allFields as $name => $value) {
+ $config = $meta->config($name);
+ $output .= static::render($name, $value, $config);
}
if (!empty($options['submit'])) {
--
Gitblit v1.10.0