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/Fields.php |   77 +++++++++++++++++++++++++++-----------
 1 files changed, 54 insertions(+), 23 deletions(-)

diff --git a/inc/registrar/Fields.php b/inc/registrar/Fields.php
index f310a3f..5635c0c 100644
--- a/inc/registrar/Fields.php
+++ b/inc/registrar/Fields.php
@@ -17,7 +17,7 @@
 
 class Fields {
 	protected array $fields;
-	protected Registrar $registrar;
+	private Registrar $registrar;
 
 	public function __construct(?string $type = null, ?Registrar $registrar = null) {
 		$this->registrar = $registrar;
@@ -50,9 +50,56 @@
 
 	public function addPostFields():void
 	{
+		$statuses = [
+//					'all' => [
+//						'icon' => 'infinity',
+//						'label' => 'Everything',
+//					],
+			'publish' => [
+				'icon' => 'eye',
+				'label' => 'Live',
+			],
+			'draft' => [
+				'icon' => 'eye-closed',
+				'label' => 'Hidden',
+			],
+			'trash' => [
+				'label' => 'Scrapped',
+				'icon' => 'trash',
+			],
+//			'delete'	=> [
+//				'label'	=> 'Permanently Delete',
+//				'icon'	=> 'trash'
+//			]
+		];
+		if ($this->registrar->hasFeature('is_calendar')) {
+			$statuses = [
+				'future'	=> [
+					'icon'	=> '',
+					'label'	=> 'Upcoming',
+				],
+				'past'	=> [
+					'icon'	=> '',
+					'label'	=> 'Past',
+				],
+				'repeat'	=> [
+					'icon'	=> '',
+					'label'	=> 'Repeating',
+				],
+				'draft' => [
+					'icon' => 'eye-closed',
+					'label' => 'Hidden',
+				],
+				'trash' => [
+					'label' => 'Scrapped',
+					'icon' => 'trash',
+				],
+			];
+		}
 		$fields = [
 			'post_thumbnail'	=> [
 				'type'	=> 'upload',
+				'subtype'	=> 'image',
 				'multiple'=> false,
 				'label'	=> 'Main Image',
 			],
@@ -60,6 +107,11 @@
 				'type'	=> 'datetime',
 				'label'	=> 'Date',
 			],
+			'post_modified' => [
+				'type'	=> 'datetime',
+				'label'	=> 'Date Modified',
+				'hidden'	=> true,
+			],
 			'post_content' => [
 				'type'	=> 'textarea',
 				'quill'	=> true,
@@ -79,28 +131,7 @@
 				'type'		=> 'radio',
 				'label'		=> 'Status',
 				'default'	=> 'draft',
-				'options'	=> [
-					'all' => [
-						'icon' => 'infinity',
-						'label' => 'Everything',
-					],
-					'publish' => [
-						'icon' => 'eye',
-						'label' => 'Live',
-					],
-					'draft' => [
-						'icon' => 'eye-closed',
-						'label' => 'Hidden',
-					],
-					'trash' => [
-						'label' => 'Scrapped',
-						'icon' => 'trash',
-					],
-					'delete'	=> [
-						'label'	=> 'Permanently Delete',
-						'icon'	=> 'trash'
-					]
-				]
+				'options'	=> $statuses
 			]
 		];
 

--
Gitblit v1.10.0