From d7e7d248cbe41cd7a9ef9c2fb022b6c4831f99a3 Mon Sep 17 00:00:00 2001
From: Jake Vanderwerf <get@jakevanderwerf.ca>
Date: Sun, 31 May 2026 15:22:56 +0000
Subject: [PATCH] =jakevan complete
---
inc/registrar/config/seo/Resolver.php | 14 ++++++++++++--
1 files changed, 12 insertions(+), 2 deletions(-)
diff --git a/inc/registrar/config/seo/Resolver.php b/inc/registrar/config/seo/Resolver.php
index db40ea7..99b4586 100644
--- a/inc/registrar/config/seo/Resolver.php
+++ b/inc/registrar/config/seo/Resolver.php
@@ -15,7 +15,7 @@
class Resolver {
protected static ?Meta $meta;
- public static function resolve(string $template, ?Meta $meta): string
+ public static function resolve(string $template, ?Meta $meta): string|array|\JVBase\managers\SEO\render\Thing\Thing
{
if (!$meta) {
if (is_singular()){
@@ -25,6 +25,11 @@
}
}
self::$meta = $meta;
+
+ if (preg_match('/^\{\{([^}]+)}}$/', trim($template), $matches)) {
+ return self::resolveVariable($matches[1], $meta);
+ }
+
return preg_replace_callback(
'/\{\{([^}]+)}}/',
fn($matches) => self::resolveVariable($matches[1], $meta),
@@ -34,6 +39,7 @@
protected static function resolveVariable(string $variable, ?Meta $meta = null): mixed
{
$variable = trim($variable);
+
switch ($variable) {
case 'CREATOR':
return JVB()->seo()->getCreator();
@@ -50,6 +56,10 @@
if (str_contains($variable, '.') && $meta) {
return self::resolveRelation($variable, $meta);
}
+ $function = BASE.'resolve_'.$variable;
+ if (function_exists($function)) {
+ return $function($variable, $meta);
+ }
if ($meta && $variable === 'post_permalink') {
return get_the_permalink($meta->id());
}
@@ -78,7 +88,6 @@
$relation = array_shift($parts);
$field = implode('.', $parts);
-
//We need to:
// 1) Get the id of the item we're fetching (meta value of the $relation)
if ($relation === 'registrar') {
@@ -94,6 +103,7 @@
if (!$meta) {
return'';
}
+
$ID = $meta->get($relation);
if (empty($ID)) {
return '';
--
Gitblit v1.10.0