From c4aa5cdb5e90ad4b420e22772797d16980232a2b Mon Sep 17 00:00:00 2001
From: Jake Vanderwerf <get@jakevanderwerf.ca>
Date: Wed, 15 Apr 2026 18:38:55 +0000
Subject: [PATCH] =Updating custom tables to utilize CustomTable.php
---
inc/rest/routes/TermRoutes.php | 17 ++++++++---------
1 files changed, 8 insertions(+), 9 deletions(-)
diff --git a/inc/rest/routes/TermRoutes.php b/inc/rest/routes/TermRoutes.php
index 431c7b5..f536bba 100644
--- a/inc/rest/routes/TermRoutes.php
+++ b/inc/rest/routes/TermRoutes.php
@@ -1,9 +1,8 @@
<?php
namespace JVBase\rest\routes;
-use JVBase\JVB;
+use JVBase\registrar\Registrar;
use JVBase\rest\Rest;
-use JVBase\managers\TaxonomyRelationships;
use JVBase\managers\UserTermsManager;
use JVBase\rest\Route;
use JVBase\utility\Features;
@@ -89,7 +88,7 @@
// Add relationship data if requested
if ($request->get_param('include_relationships')) {
- $relationship_manager = new TaxonomyRelationships();
+ $relationship_manager = JVB()->termRelationships();
$related_taxonomies = $request->get_param('related_taxonomies') ?: ['jvb_style', 'jvb_theme', 'jvb_city'];
$data['relationships'] = [];
@@ -194,8 +193,8 @@
if (array_key_exists('content', $data)) {
// If content_type is provided, use the specialized endpoint
$content_type = $request->get_param('content');
- global $feed_types;
- if (taxIsJVBContentTax($content_type)) {
+ $registrar = Registrar::getInstance($content_type);
+ if ($registrar->hasFeature('is_content')) {
$response = $this->getTermsForContentType($request);
return $this->addCacheHeaders($response);
}
@@ -239,7 +238,7 @@
$main_context = json_decode($request->get_param('main_context'), true);
$userID = get_post_meta($main_context['id'], BASE.'link', true);
$manager = new UserTermsManager();
- $related = $manager->getUserTermIDs($userID, $taxonomy);
+ $related = $manager->fetchUserTerms($userID, $taxonomy);
if (empty($related)) {
$response = $this->emptyResult();
@@ -252,7 +251,7 @@
$main_context = json_decode($request->get_param('main_context'), true);
$thisTaxonomy = str_replace('taxonomy:', '', $main_context['context']);
$ID = (int)$main_context['id'];
- $manager = new TaxonomyRelationships();
+ $manager = JVB()->termRelationships();
$related = $manager->getRelatedTerms($ID, BASE.$request->get_param('taxonomy'));
if (empty($related)) {
@@ -270,7 +269,7 @@
$match = $request->get_param('match') ?? 'any';
$context = json_decode($request['context'], true);
- $relationshipManager = new TaxonomyRelationships();
+ $relationshipManager = JVB()->termRelationships();
// Prepare array to collect term IDs that match the context
$related_term_ids = [];
@@ -584,7 +583,7 @@
*/
public function getTermsForContentType(WP_REST_Request $request):WP_REST_Response
{
- $manager = new TaxonomyRelationships();
+ $manager = JVB()->termRelationships();
$content_type = BASE . $request->get_param('content');
$taxonomy = BASE . $request->get_param('taxonomy');
$search = $request->get_param('search');
--
Gitblit v1.10.0