From c19264ac916707096fe294d996a1b7fb85206b34 Mon Sep 17 00:00:00 2001
From: Jake Vanderwerf <get@jakevanderwerf.ca>
Date: Sun, 08 Mar 2026 19:55:31 +0000
Subject: [PATCH] =Furthering along the complete refactor. Added some basic setup for is_content taxonomies, including a page for an archive of the terms.

---
 inc/registrar/fields/Field.php |   17 ++++++++++++++---
 1 files changed, 14 insertions(+), 3 deletions(-)

diff --git a/inc/registrar/fields/Field.php b/inc/registrar/fields/Field.php
index 6bbe401..e34c80e 100644
--- a/inc/registrar/fields/Field.php
+++ b/inc/registrar/fields/Field.php
@@ -37,12 +37,23 @@
 				return;
 			}
 		}
+		$current = get_class($this);
+		$class = match($config['type']) {
+			'group'	=> ($current !== GroupedField::class) ? new GroupedField($name, $config) : $this,
+			'select', 'radio', 'checkbox' => ($current !== OptionsField::class) ? new OptionsField($name, $config) : $this,
+			'repeater' => ($current !== RepeaterField::class) ? new RepeaterField($name, $config) : $this,
+			'taglist' => ($current !== TagListField::class) ? new TagListField($name, $config) : $this,
+			'taxonomy', 'post', 'user', 'selector' => ($current !== SelectorField::class) ? new SelectorField($name, $config) : $this,
+			'upload' => ($current !== UploadField::class) ? new UploadField($name, $config) : $this,
+			default => $this
+		};
+
 		foreach ($config as $key => $value) {
-			if (property_exists($this, $key)) {
+			if (property_exists($class, $key)) {
 				$method = 'set' . ucfirst($key);
-				$this->$method($value);
+				$class->$method($value);
 			} else {
-				error_log('Instance: '.print_r($this, true));
+				error_log('Instance: '.print_r($class, true));
 				error_log('[JVBase\registrar\Field] Invalid key for '.$name.': '.$key);
 			}
 		}

--
Gitblit v1.10.0