From a8ff85042ffbfe94b678fd818c02deb613bfd116 Mon Sep 17 00:00:00 2001
From: Jake Vanderwerf <get@jakevanderwerf.ca>
Date: Fri, 07 Aug 2026 20:42:54 +0000
Subject: [PATCH] =Continuing on with Integrations setup. Working on PostMark now
---
inc/integrations/Field.php | 31 +++++++++++++++++++++++++++++--
1 files changed, 29 insertions(+), 2 deletions(-)
diff --git a/inc/integrations/Field.php b/inc/integrations/Field.php
index 788400b..61cfc55 100644
--- a/inc/integrations/Field.php
+++ b/inc/integrations/Field.php
@@ -17,14 +17,17 @@
protected array $options;
protected mixed $default;
protected string $subtype;
+ protected string $placeholder;
protected bool $hidden = false;
+ protected int $min;
+ protected int $max;
public function __construct(string $name, string $label, string $type, callable|string|bool $permission)
{
$this->name = $name;
$this->label = $label;
$this->type = $type;
- $this->permission = $permission;
+ $this->permission = is_callable($permission) ? Closure::fromCallable($permission) : $permission;
}
public function checkPermission():bool
@@ -69,7 +72,21 @@
public function setSubType(string $type):void
{
- $this->subType = $type;
+ $this->subtype = $type;
+ }
+
+ public function setMin(int $min):void
+ {
+ $this->min = $min;
+ }
+ public function setMax(int $max):void
+ {
+ $this->max = $max;
+ }
+
+ public function setPlaceholder(string $string):void
+ {
+ $this->placeholder = sanitize_text_field($string);
}
public function getConfig():array
@@ -97,6 +114,16 @@
if ($this->hidden) {
$conf['hidden'] = true;
}
+ if (isset($this->min)) {
+ $conf['min'] = $this->min;
+ }
+ if (isset($this->max)) {
+ $conf['max'] = $this->max;
+ }
+ if (isset($this->placeholder)) {
+ $conf['placeholder'] = $this->placeholder;
+ }
return $conf;
}
+
}
--
Gitblit v1.10.0