From 772462eeca3002a1d52508aeba485aab2b4742ad Mon Sep 17 00:00:00 2001
From: Jake Vanderwerf <get@jakevanderwerf.ca>
Date: Tue, 03 Mar 2026 19:06:19 +0000
Subject: [PATCH] =MAJOR OVERHAUL. Likely should have made a new branch ages ago. Key changes: Registrar.php is the base for custom post types, taxonomies, and user roles. Replaces JVB_CONTENT, JVB_TAXONOMY, and JVB_USER constants, eliminates most of Features.php (except for JVB_SITE, JVB_MEMBERSHIP), and has built in sanitizing and validation via sub-classes. Also started a major overhaul of the Schema output. Created a shit ton of property traits and classes to help sanitize and ensure proper data for different schema types. Still a bunch to do, but better to be starting committing changes here on this other branch.

---
 inc/managers/IconsManager.php |   31 ++++++++++---------------------
 1 files changed, 10 insertions(+), 21 deletions(-)

diff --git a/inc/managers/IconsManager.php b/inc/managers/IconsManager.php
index 65e583d..3e12e60 100644
--- a/inc/managers/IconsManager.php
+++ b/inc/managers/IconsManager.php
@@ -1,6 +1,7 @@
 <?php
 namespace JVBase\managers;
 
+use JVBase\registrar\Registrar;
 use JVBase\utility\Features;
 
 if (!defined('ABSPATH')) {
@@ -198,12 +199,7 @@
 		// Add icons from content/taxonomy/user configs (like old behavior)
 		$configIcons = $this->getIconsFromConfigs();
 		if (!empty($configIcons)) {
-			foreach ($configIcons as $source => $icons) {
-				if (!isset($defaults[$source])) {
-					$defaults[$source] = [];
-				}
-				$defaults[$source] = array_merge($defaults[$source], $icons);
-			}
+			$defaults['icons'] = array_merge($defaults['icons'], $configIcons);
 		}
 
 		// Allow filtering per source (extensibility)
@@ -221,28 +217,21 @@
 	}
 
 	/**
-	 * Get icons from JVB_CONTENT, JVB_TAXONOMY, JVB_USER configs
+	 * Get icons from Registrar instances
+	 *
 	 */
 	protected function getIconsFromConfigs(): array
 	{
 		$icons = [];
-		$check = [JVB_CONTENT, JVB_TAXONOMY, JVB_USER];
+		$registered = Registrar::getRegistered();
 
-		foreach ($check as $constant) {
-			foreach ($constant as $key => $value) {
-				if (isset($value['icon'])) {
-					// Determine source based on context (you could add 'icon_source' to configs)
-					$source = $value['icon_source'] ?? 'icons';
-
-					if (!isset($icons[$source])) {
-						$icons[$source] = [];
-					}
-					$icons[$source][] = $value['icon'];
-				}
-			}
+		foreach ($registered as $type) {
+			$registrar = Registrar::getInstance($type);
+			$icons[] = $registrar->getIcon();
 		}
 
-		return $icons;
+
+		return array_unique(array_filter($icons));
 	}
 
 	/**

--
Gitblit v1.10.0