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/ui/CRUDSkeleton.php |   58 +++++++++++++++++++---------------------------------------
 1 files changed, 19 insertions(+), 39 deletions(-)

diff --git a/inc/ui/CRUDSkeleton.php b/inc/ui/CRUDSkeleton.php
index 515c0d5..380a25b 100644
--- a/inc/ui/CRUDSkeleton.php
+++ b/inc/ui/CRUDSkeleton.php
@@ -2,8 +2,7 @@
 namespace JVBase\ui;
 
 use JVBase\managers\UserTermsManager;
-use JVBase\meta\MetaForm;
-use JVBase\meta\MetaManager;
+use JVBase\meta\Form;
 use WP_User;
 
 if (!defined('ABSPATH')) {
@@ -121,10 +120,6 @@
 	protected $dataSourceCallback = null;
 	protected array $templates = [];
 
-	// Metadata handling
-	protected ?MetaManager $meta = null;
-	protected ?MetaForm $form = null;
-
 	// UI Options
 	protected array $stuck = []; // Fields that stick when scrolling
 	protected bool $showHeader = true;
@@ -498,14 +493,6 @@
 		return $this;
 	}
 
-	/**
-	 * Initialize meta handling
-	 */
-	public function initMeta(string $objectType = 'post', ?string $content = null): self {
-		$this->meta = new MetaManager(null, $objectType, $content ?? $this->dataType);
-		$this->form = new MetaForm();
-		return $this;
-	}
 
 	/**
 	 * Build the configuration array
@@ -540,7 +527,7 @@
 		$config = $this->build();
 		$classes = array_merge(['dashboard-page', $this->dataType], $this->additionalClasses);
 
-		ob_start();
+//		ob_start();
 		?>
 		<div class="<?= esc_attr(implode(' ', $classes)) ?>" data-type="<?= esc_attr($this->dataType) ?>">
 			<?php
@@ -553,7 +540,7 @@
 			?>
 		</div>
 		<?php
-		echo ob_get_clean();
+//		echo ob_get_clean();
 	}
 
 	/**
@@ -580,16 +567,13 @@
 	 * Render uploader section
 	 */
 	protected function renderUploader(): void {
-		if (!$this->meta) {
-			return;
-		}
 		?>
 		<details open class="uploader">
 			<summary class="row btw"><?= esc_html($this->uploaderConfig['label'] ?? 'Upload Files') ?></summary>
 			<?php
-			$this->meta->render(
-				'form',
+			echo Form::render(
 				'new_' . $this->dataType,
+				null,
 				$this->uploaderConfig
 			);
 			?>
@@ -1057,9 +1041,9 @@
 			$temp = array_filter($this->fields, function ($field) {
 				return in_array($field, $this->timelineUniqueFields);
 			}, ARRAY_FILTER_USE_KEY);
-			$form = new MetaForm();
+
 			echo '<template class="timelineItem">';
-			$form->renderImagePreview(null,['fields' => $temp]);
+			echo Form::renderImagePreview(null, ['fields' => $temp]);
 			echo '</template>';
 		}
 		if (!array_key_exists('empty', $templates)) {
@@ -1265,7 +1249,7 @@
 								$config['autocomplete'] = true;
 							}
 
-							echo $this->meta->render('form', $name, $config);
+							echo Form::render($name, null, $config);
 							echo $makeThisDetailed ? '</details>' : '';
 						} else {
 							echo '<p></p>';
@@ -1348,7 +1332,7 @@
 							$config['autocomplete'] = true;
 						}
 						?>
-						<?php $this->meta->render('form', $name, $config); ?>
+						<?= Form::render($name, null, $config); ?>
 						<?= $makeThisDetailed ? '</details>' : '' ?>
 					</td>
 					<?php
@@ -1376,7 +1360,7 @@
 					?>
 					<td class="field show-<?= esc_attr($name) ?>" data-field="<?= esc_attr($name) ?>" data-field-type="<?=$config['type']?>"<?=(in_array($name, $this->stuck)) ? ' data-stuck':''?>>
 						<?= $makeThisDetailed ? '<details><summary class="row btw">See Value</summary>' : '' ?>
-						<?php $this->meta->render('form', $name, $config); ?>
+						<?= Form::render($name, null, $config); ?>
 						<?= $makeThisDetailed ? '</details>' : '' ?>
 					</td>
 					<?php
@@ -1600,9 +1584,9 @@
 					foreach ($first as $f) {
 						if (array_key_exists($f, $fields)) {
 							if ($tabs) {
-								$tabs['basic']['content'] .= $this->meta->render('form', $f, $fields[$f], false, true);
+								$tabs['basic']['content'] .= Form::render($f, null, $fields[$f]);
 							} else {
-								$this->meta->render('form', $f, $fields[$f]);
+								Form::render($f, null, $fields[$f]);
 							}
 
 							unset($fields[$f]);
@@ -1627,12 +1611,12 @@
 							if (in_array($field['type'], ['taxonomy', 'selector'])) {
 								$field = array_merge($field, $this->taxConfig($field['taxonomy'], $field['label']));
 							}
-							$content .= $this->form->render($slug, null, $field, false, true);
+							$content .= Form::render($slug, null, $field);
 						}
 					}
 
 
-					$content .= $this->meta->render('form', 'timeline', $config, false,true);
+					$content .= Form::render('timeline', null, $config);
 
 					$tabs['progression']['content'] = $content;
 					$fields = $this->nonTimelineFields;
@@ -1640,12 +1624,12 @@
 				foreach ($fields as $n => $config) {
 					if ($tabs) {
 						$section = (array_key_exists('section', $config)) ? $config['section'] : 'basic';
-						$tabs[$section]['content'] .= $this->meta->render('form', $n, $config, false, true);
+						$tabs[$section]['content'] .= Form::render($n,null, $config);
 					} else {
 						if (in_array($config['type'], ['taxonomy', 'selector'])) {
 							$config = array_merge($config, $this->taxConfig($config['taxonomy'], $config['label']));
 						}
-						$this->meta->render('form', $n, $config);
+						Form::render($n, null, $config);
 					}
 				}
 
@@ -1657,6 +1641,7 @@
 		</form>
 		<?php
 		return ob_get_clean();
+//		return '';
 	}
 
 	protected function renderEditModal():void
@@ -1690,12 +1675,7 @@
 					<div class="taxonomies">
 						<?php
 						foreach ($this->taxonomies as $taxonomy => $config) {
-							$this->form->renderSelectorField(
-								'bulk-edit-'.$taxonomy,
-								'',
-								$this->taxConfig($taxonomy, $config['label']),
-								'taxonomy'
-							);
+							echo Form::render('bulk-edit-'.$taxonomy, '', $this->taxConfig($taxonomy, $config['label']));
 						}
 						?>
 					</div>
@@ -1706,7 +1686,7 @@
 					return array_key_exists('bulkEdit', $field);
 				});
 				foreach ($fields as $fieldName => $config) {
-					$this->meta->render('form', $fieldName, $config);
+					echo Form::render($fieldName, null, $config);
 				}
 				?>
 			</div>

--
Gitblit v1.10.0