From c348d35c7ecb6c74f71cf90b982412f267c5d807 Mon Sep 17 00:00:00 2001
From: Jake Vanderwerf <get@jakevanderwerf.ca>
Date: Tue, 10 Feb 2026 02:19:05 +0000
Subject: [PATCH] =minor fixes to schema system
---
inc/managers/SEO/SchemaFieldHelpers.php | 20 ++++++++++++++++++++
1 files changed, 20 insertions(+), 0 deletions(-)
diff --git a/inc/managers/SEO/SchemaFieldHelpers.php b/inc/managers/SEO/SchemaFieldHelpers.php
index a4bf981..e3d544c 100644
--- a/inc/managers/SEO/SchemaFieldHelpers.php
+++ b/inc/managers/SEO/SchemaFieldHelpers.php
@@ -981,6 +981,26 @@
return $formatted;
}
+
+ /**
+ * Build a JSON-LD @id reference
+ * String → ['@id' => $value], array with @id → pass through
+ */
+ public static function reference(mixed $value): array|string
+ {
+ if (is_array($value) && isset($value['@id'])) {
+ return $value;
+ }
+
+ if (is_string($value) && !empty($value)) {
+ return ['@id' => $value];
+ }
+
+ return $value;
+ }
+
+
+
/**
* Build SiteNavigationElement array from navigation items
*/
--
Gitblit v1.10.0