From 275c0d74cd68677622a5431505c5c870c473063d Mon Sep 17 00:00:00 2001
From: Jake Vanderwerf <get@jakevanderwerf.ca>
Date: Sun, 29 Mar 2026 21:40:15 +0000
Subject: [PATCH] =Seems to be working, huzzah! Added some changes for on-this-page nav
---
inc/meta/Field.php | 16 ++++++++++++----
1 files changed, 12 insertions(+), 4 deletions(-)
diff --git a/inc/meta/Field.php b/inc/meta/Field.php
index c6cf372..3c81135 100644
--- a/inc/meta/Field.php
+++ b/inc/meta/Field.php
@@ -17,6 +17,7 @@
public array $config;
public bool $isDirty = false;
public bool $isValid = true;
+ public bool $isDefault = false;
public array $errors = [];
public function __construct(string $name, mixed $value, array $config = [])
@@ -25,6 +26,9 @@
$this->value = $value;
$this->originalValue = $value;
$this->config = $config;
+ if (array_key_exists('wp', $config) && $config['wp'] === true) {
+ $this->isDefault = true;
+ }
}
/**
@@ -32,8 +36,12 @@
*/
public function set(mixed $value): self
{
- $this->value = $value;
- $this->isDirty = ($value !== $this->originalValue);
+ error_log('Checking if value is the same as old value: '.print_r($value, true));
+ if ($value !== $this->value) {
+ error_log('Saving new value: '.print_r($value, true));
+ $this->value = $value;
+ $this->isDirty = true;
+ }
return $this;
}
@@ -98,7 +106,7 @@
*/
public function isWpDefault(): bool
{
- return $this->config['_wp_default'] ?? false;
+ return $this->isDefault ?? false;
}
/**
@@ -106,7 +114,7 @@
*/
public function isTaxonomy(): bool
{
- return $this->type() === 'taxonomy' && !isset($this->config['taxonomy_type']);
+ return ($this->type() === 'taxonomy' || ($this->type() === 'selector' && isset($this->config['subtype']) && $this->config['subtype'] === 'taxonomy')) && !isset($this->config['isReference']);
}
/**
--
Gitblit v1.10.0