From 8318f60480aedd4aa1e64dc35468247dfbba9316 Mon Sep 17 00:00:00 2001
From: Jake Vanderwerf <get@jakevanderwerf.ca>
Date: Wed, 09 Sep 2026 22:44:54 +0000
Subject: [PATCH] =Simplified event fields a bit, removed the recurrence for now to get Northeh done. Scaffolded a basic block to select a specific field to render anywhere.
---
inc/registrar/helpers/AddCustomFields.php | 27 +++++++++++++++++----------
1 files changed, 17 insertions(+), 10 deletions(-)
diff --git a/inc/registrar/helpers/AddCustomFields.php b/inc/registrar/helpers/AddCustomFields.php
index 292d6e2..c9709ff 100644
--- a/inc/registrar/helpers/AddCustomFields.php
+++ b/inc/registrar/helpers/AddCustomFields.php
@@ -73,8 +73,15 @@
foreach ($this->registrar->getFields(false) as $name => $config) {
$metaType = $this->getSchemaType($config);
- $schema = $metaType === 'array' ? $this->determineSchema($config) : true;
+ $rawSchema = in_array($metaType, ['array', 'object'], true)
+ ? $this->determineSchema($config)
+ : true;
+ $schema = is_array($rawSchema) ? $this->schema($rawSchema) : $rawSchema;
+ //Allow for null
+ if ($metaType === 'object') {
+ $metaType = ['object', 'null'];
+ }
register_post_meta($this->registrar->getBased(), jvbCheckBase($name), [
'single' => true,
'type' => $metaType,
@@ -163,16 +170,16 @@
$required[] = $name;
}
- $schema = $this->determineSchema($c);
- if (is_array($schema)) {
- if (array_key_exists('default', $schema)) {
- $args['default'] = $schema['default'];
+ $tmp = $this->determineSchema($c);
+ if (is_array($tmp)) {
+ if (array_key_exists('default', $tmp)) {
+ $args['default'] = $tmp['default'];
}
- if (array_key_exists('enum', $schema)) {
- $args['enum'] = $schema['enum'];
+ if (array_key_exists('enum', $tmp)) {
+ $args['enum'] = $tmp['enum'];
}
- if (array_key_exists('format', $schema)) {
- $args['format'] = $schema['format'];
+ if (array_key_exists('format', $tmp)) {
+ $args['format'] = $tmp['format'];
}
}
if (array_key_exists('default', $c)) {
@@ -201,7 +208,7 @@
protected function schemaLocation(array $config):array|true
{
return [
- 'type' => 'object',
+ 'type' => ['object', 'null'],
'properties' => [
'address' => [
'type' => 'string'
--
Gitblit v1.10.0