From 86c6cd3cc099d2480932ede03c12cea01e625c94 Mon Sep 17 00:00:00 2001
From: Jake Vanderwerf <get@jakevanderwerf.ca>
Date: Sun, 26 Apr 2026 21:56:28 +0000
Subject: [PATCH] =Requiring files based on Site class settings
---
inc/registry/TaxonomyRegistrar.php | 55 +++++++++++++++----------------------------------------
1 files changed, 15 insertions(+), 40 deletions(-)
diff --git a/inc/registry/TaxonomyRegistrar.php b/inc/registry/TaxonomyRegistrar.php
index 489dd12..21f4450 100644
--- a/inc/registry/TaxonomyRegistrar.php
+++ b/inc/registry/TaxonomyRegistrar.php
@@ -1,12 +1,9 @@
<?php
namespace JVBase\registry;
-use JVBase\meta\MetaManager;
-use JVBase\meta\MetaRegistry;
-use JVBase\managers\CacheManager;
-use JVBase\utility\Checker;
-use Exception;
-use WP_Error;
+use JVBase\managers\CRUD;
+use JVBase\meta\Meta;
+use JVBase\meta\Registry;
if (!defined('ABSPATH')) {
exit;
}
@@ -31,7 +28,7 @@
if ($this->config['is_content'] ?? false) {
$this->setupContentTaxonomyHooks();
}
- $this->registerHooks();
+ add_filter('jvbDashboardPage', [$this, 'renderDashPage'], 10, 3);
}
public function register(): void
@@ -57,7 +54,7 @@
$this->maybeAddRewriteRule($args['rewrite']);
if (!empty($this->fields)) {
- $meta_registry = new MetaRegistry($this->fields, $this->slug, 'term');
+ $meta_registry = new Registry($this->fields, $this->slug, 'term');
$meta_registry->registerMetaFields();
}
}
@@ -217,13 +214,13 @@
// Prepare data for insertion/update
$data = [
'term_id' => $term_id,
- 'name' => $term->name,
+ 'name' => html_entity_decode($term->name),
'slug' => $term->slug,
'updated_at' => current_time('mysql')
];
// Get meta manager for this term
- $meta = new MetaManager($term_id, 'term');
+ $meta = Meta::forTerm($term_id);
$values = $meta->getAll(array_keys($custom_fields));
// Process each custom field
@@ -338,37 +335,15 @@
return $data;
}
- /**
- * Get custom table fields for this taxonomy
- * @return array Field definitions
- */
- protected function getCustomTableFields():array
- {
- return jvbContentTaxonomiesTableFields($this->slug)['fields'] ?? [];
- }
-
- protected function registerHooks():void
+ public function renderDashPage(string $content, string $page, string $slug):string
{
- $actions = ['created_term', 'edited_term', 'delete_term'];
- $taxonomy = $this->taxonomy;
- foreach ($actions as $action) {
- add_action($action, function($term_id, $tt_id, $tax) use ($taxonomy, $action) {
- if ($tax !== $taxonomy) return;
-
- $term = get_term($term_id, $tax);
-
- CacheManager::for(jvbNoBase($taxonomy))->invalidate();
-
- // Clear cache for associated content types
- $checker = Checker::getInstance();
- $content_types = $checker->getContentForTaxonomy($taxonomy);
-
- foreach ($content_types as $content_type) {
- CacheManager::for($content_type)->invalidate();
- }
-
- do_action("jvb_taxonomy_cache_invalidated_{$taxonomy}", $term, $action);
- }, 10, 3);
+ if ($slug === $this->slug) {
+ ob_start();
+ $crud = new CRUD($slug);
+ $crud->render();
+ return ob_get_clean();
}
+
+ return $content;
}
}
--
Gitblit v1.10.0