From 9bbeea742424837fb58207d88e10dbca0b2cae04 Mon Sep 17 00:00:00 2001
From: Jake Vanderwerf <get@jakevanderwerf.ca>
Date: Sun, 03 May 2026 22:04:17 +0000
Subject: [PATCH] =SEO Field registration and formatting
---
inc/managers/SEO/render/Traits/_Properties/aboutTrait.php | 29 ++++++++++++++++++++++++++++-
1 files changed, 28 insertions(+), 1 deletions(-)
diff --git a/inc/managers/SEO/render/Traits/_Properties/aboutTrait.php b/inc/managers/SEO/render/Traits/_Properties/aboutTrait.php
index 633666a..4ef2753 100644
--- a/inc/managers/SEO/render/Traits/_Properties/aboutTrait.php
+++ b/inc/managers/SEO/render/Traits/_Properties/aboutTrait.php
@@ -2,6 +2,7 @@
namespace JVBase\managers\SEO\render\Traits\_Properties;
use JVBase\managers\SEO\render\Thing\Thing;
+use JVBase\registrar\config\seo\Resolver;
if (!defined('ABSPATH')) {
exit;
@@ -17,8 +18,34 @@
{
return $this->about??null;
}
- public function setAbout(Thing $about):void
+ public function setAbout(Thing|array $about):void
{
+ if (is_array($about)) {
+ if (!array_key_exists('type', $about)) {
+ error_log('[aboutTrait] Needs to have a type key'.print_r($about, true));
+ return;
+ }
+ if (!class_exists($about['type'])) {
+ error_log('[aboutTrait] Class not found for: '.print_r($about['type'], true));
+ return;
+ }
+ $class = new $about['type']();
+ $className = $about['type'];
+ unset($about['type']);
+ foreach ($about as $key => $value) {
+ $method = 'set'.ucfirst($key);
+ if (method_exists($class, $method)) {
+ if (is_string($value) && str_contains($value, '{{')) {
+ $value = Resolver::resolveForSchema($key, $value, $class);
+ }
+ error_log('Setting '.$key.' to '.print_r($value, true));
+ $class->$method($value);
+ } else {
+ error_log('[aboutTrait] Invalid method: '.$method.', for class: '.$className);
+ }
+ }
+ $about = $class;
+ }
$this->about = $about;
}
}
--
Gitblit v1.10.0