From ba1e1ccf869b818f7a7a897264dfea05563a7796 Mon Sep 17 00:00:00 2001
From: Jake Vanderwerf <get@jakevanderwerf.ca>
Date: Sun, 07 Jun 2026 20:10:20 +0000
Subject: [PATCH] =Major overhaul of Integrations. Playing around with adding fields to post types through Registrar from an integrations' class file.
---
inc/registrar/config/Section.php | 15 ++++++++++-----
1 files changed, 10 insertions(+), 5 deletions(-)
diff --git a/inc/registrar/config/Section.php b/inc/registrar/config/Section.php
index 15e2def..10ac615 100644
--- a/inc/registrar/config/Section.php
+++ b/inc/registrar/config/Section.php
@@ -13,10 +13,11 @@
protected string $description = '';
protected string $icon = '';
protected array $fields = [];
+ private Registrar $registrar;
- public function __construct(string $title) {
- $this->title = $title;
- $this->slug = sanitize_title($title);
+ public function __construct(string $slug, Registrar $registrar) {
+ $this->slug = sanitize_title($slug);
+ $this->registrar = $registrar;
}
public function setTitle(string $title): self {
@@ -25,7 +26,7 @@
}
public function getTitle():string
{
- return $this->title;
+ return $this->title ?? ucwords(implode(' ', explode('-', $this->slug)));
}
public function setDescription(string $description):self
@@ -43,10 +44,14 @@
$this->icon = $icon;
return $this;
}
+ public function getIcon():string
+ {
+ return $this->icon;
+ }
protected function checkFields(string|array $fields):string|array
{
- $allFields = Registrar::getInstance($this->slug)->getFields();
+ $allFields = $this->registrar->getFields();
if (is_array($fields)){
foreach ($fields as $index =>$fieldName){
if (!array_key_exists($fieldName, $allFields)){
--
Gitblit v1.10.0