From 2127b1bdd73ecd2423e443992da4b442f5a3c1a3 Mon Sep 17 00:00:00 2001
From: Jake Vanderwerf <get@jakevanderwerf.ca>
Date: Wed, 04 Feb 2026 21:19:25 +0000
Subject: [PATCH] =Major overhaul of MetaManager.php -> Meta.php and RestRouteManager.php -> Rest.php. Seems to work for JakeVan
---
inc/registry/OptionsRegistry.php | 22 ++++++----------------
1 files changed, 6 insertions(+), 16 deletions(-)
diff --git a/inc/registry/OptionsRegistry.php b/inc/registry/OptionsRegistry.php
index a21f2d8..391b842 100644
--- a/inc/registry/OptionsRegistry.php
+++ b/inc/registry/OptionsRegistry.php
@@ -4,7 +4,9 @@
if (!defined('ABSPATH')) {
exit;
}
-use JVBase\meta\MetaManager;
+
+use JVBase\meta\Form;
+use JVBase\meta\Meta;
class OptionsRegistry
{
@@ -22,7 +24,7 @@
*/
public function registerOptions(): void
{
- $meta = new MetaManager(null, 'options');
+ $meta = Meta::forOptions('options');
foreach ($this->fields as $field_name => $field) {
if (in_array($field_name, ['common', 'fields'])) {
continue;
@@ -34,7 +36,7 @@
// Add default value if not exists
if (get_option($option_name) === false) {
- add_option($option_name, $field['default'] ?? $meta->getDefaultValue($field['type']));
+ add_option($option_name, $field['default'] ??'');
}
//
@@ -87,11 +89,7 @@
$name = $args['name'];
$value = get_option(BASE . $name);
- // Use MetaForm to render if available
- if (class_exists('\JVBase\meta\MetaForm')) {
- $form = new \JVBase\meta\MetaForm();
- echo $form->renderField($name, $field, $value);
- }
+ echo Form::render($name, $value, $field);
}
private function getFieldType(string $type): string
@@ -104,12 +102,4 @@
default => 'string'
};
}
-
- private function getSanitizeCallback(array $field): callable
- {
- return function($value) use ($field) {
- $manager = new \JVBase\meta\MetaManager();
- return $manager->sanitizeField($value, $field);
- };
- }
}
--
Gitblit v1.10.0