Jake Vanderwerf
2026-09-16 a239ef33ec489ce6d0f25ac2f256df0ac54a7e50
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;
   }
}