From c16a4d78d07e81ecdd2ff9b1b9090560ab2fe488 Mon Sep 17 00:00:00 2001
From: Jake Vanderwerf <get@jakevanderwerf.ca>
Date: Fri, 04 Sep 2026 22:25:09 +0000
Subject: [PATCH] =Got the panel loading up the fields, organized by section! Now to ensure it saves properly. Still need to add: upload fields, selector fields, repeater/taglist/group fields
---
inc/forms/PostSelector.php | 13 +++++++------
1 files changed, 7 insertions(+), 6 deletions(-)
diff --git a/inc/forms/PostSelector.php b/inc/forms/PostSelector.php
index 6f4ed7c..c68191d 100644
--- a/inc/forms/PostSelector.php
+++ b/inc/forms/PostSelector.php
@@ -2,6 +2,7 @@
namespace JVBase\forms;
use JVBase\managers\Cache;
+use JVBase\managers\Roles;
use WP_REST_Request;
use WP_REST_Response;
use WP_Query;
@@ -23,7 +24,7 @@
public function __construct(string $post_type, array $config = [])
{
$this->post_type = $post_type;
- $this->cache = Cache::for(jvbNoBase($post_type), WEEK_IN_SECONDS)->connect('post', true);
+ $this->cache = Cache::for(jvbNoBase($post_type), 'post',WEEK_IN_SECONDS);
$this->config = wp_parse_args($config, [
'multiple' => true,
@@ -184,8 +185,8 @@
}
// Check cache
- $cache_key = $this->cache->generateKey($args);
- $cached_result = $this->cache->get($cache_key);
+
+ $cached_result = $this->cache->get($args);
if ($cached_result) {
return new WP_REST_Response($cached_result);
}
@@ -223,7 +224,7 @@
];
// Cache the result
- $this->cache->set($cache_key, $result, 300); // 5 minute cache
+ $this->cache->set($args, $result, 300); // 5 minute cache
return new WP_REST_Response($result);
}
@@ -237,7 +238,7 @@
'methods' => 'GET',
'callback' => [new self('post'), 'searchPosts'],
'permission_callback' => function($request) {
- return JVB()->roles()->checkRole(get_current_user(), $request->get_param('post_type'));
+ return Roles::getInstance()()->checkRole(get_current_user(), $request->get_param('post_type'));
},
'args' => [
'post_type' => [
@@ -264,7 +265,7 @@
}
/**
- * Render post selector field for MetaForm integration
+ * Render post selector field for Meta's Form integration
*
* @param string $name Field name
* @param mixed $value Current value
--
Gitblit v1.10.0