From eef16f5a0f5af0aea313e411534643678ba4bea1 Mon Sep 17 00:00:00 2001
From: Jake Vanderwerf <get@jakevanderwerf.ca>
Date: Sun, 06 Sep 2026 20:58:21 +0000
Subject: [PATCH] =Polishing up the gutenberg sidebar for custom meta. Seems to be working more or less. Added integration with OpenStreetMaps for location fields. Still to add: row ordering for repeaters, Maybe a better view for the selector field (terms, posts, etc), ensure fields save correctly and repopulate.

---
 inc/registrar/helpers/AddCustomFields.php |   16 ++++++++++++----
 1 files changed, 12 insertions(+), 4 deletions(-)

diff --git a/inc/registrar/helpers/AddCustomFields.php b/inc/registrar/helpers/AddCustomFields.php
index 2e730ff..8bb2682 100644
--- a/inc/registrar/helpers/AddCustomFields.php
+++ b/inc/registrar/helpers/AddCustomFields.php
@@ -35,7 +35,7 @@
 
 		wp_enqueue_script(
 			'jvb-editor-fields',
-			JVB_URL.'/build/_meta/fields.js',
+			JVB_URL.'build/_meta/fields.js',
 			$asset['dependencies'],
 			$asset['version'],
 			true
@@ -44,13 +44,21 @@
 		wp_add_inline_script(
 			'jvb-editor-fields',
 			'window.jvbFieldConfig = '.wp_json_encode([
-				'postType' => $this->registrar->getBased(),
 				'fields'   => array_map(function($f) {
 					$f['name'] = jvbCheckBase($f['name']);
+					$f['id'] = jvbCheckBase($f['name']);
+					if ($f['type'] === 'selector') {
+						$f['taxonomy'] = jvbCheckBase($f['taxonomy']);
+					}
 					return $f;
 				},array_values($this->registrar->getFields(false))),
-				'sections'  => $this->registrar->getSections(),
-				'base'  => BASE
+				'sections'  => array_map(function ($s) {
+					$s['id'] = jvbCheckBase($s['slug']);
+					$s['fields'] = array_map(function ($f) {
+						return jvbCheckBase($f);
+					}, $s['fields']);
+					return $s;
+				},$this->registrar->getSections()),
 			]).';',
 			'before'
 		);

--
Gitblit v1.10.0