From a239ef33ec489ce6d0f25ac2f256df0ac54a7e50 Mon Sep 17 00:00:00 2001
From: Jake Vanderwerf <get@jakevanderwerf.ca>
Date: Wed, 16 Sep 2026 00:07:34 +0000
Subject: [PATCH] =Tackling the integrations again. This time Helcim, with some minnor edits to GMB and Square
---
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