From 235ce5716edc2f7cbe80fdccf26eac7269587839 Mon Sep 17 00:00:00 2001
From: Jake Vanderwerf <get@jakevanderwerf.ca>
Date: Mon, 08 Jun 2026 04:38:18 +0000
Subject: [PATCH] =FavouritesManager.php and FavouritesRoutes.php fixes. Moving all logic to FavouritesManager.php. Still some left to do
---
inc/registrar/Fields.php | 87 +++++++++++++++++++++++++++++--------------
1 files changed, 59 insertions(+), 28 deletions(-)
diff --git a/inc/registrar/Fields.php b/inc/registrar/Fields.php
index f310a3f..8e37662 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,62 @@
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_status' => [
+ 'type' => 'radio',
+ 'label' => 'Status',
+ 'default' => 'draft',
+ 'options' => $statuses
+ ],
'post_thumbnail' => [
'type' => 'upload',
+ 'subtype' => 'image',
'multiple'=> false,
'label' => 'Main Image',
],
@@ -60,6 +113,11 @@
'type' => 'datetime',
'label' => 'Date',
],
+ 'post_modified' => [
+ 'type' => 'datetime',
+ 'label' => 'Date Modified',
+ 'hidden' => true,
+ ],
'post_content' => [
'type' => 'textarea',
'quill' => true,
@@ -75,33 +133,6 @@
'label' => 'TLDR',
'maxLength' => 158,
],
- 'post_status' => [
- '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'
- ]
- ]
- ]
];
foreach ($fields as $name => $config) {
--
Gitblit v1.10.0