From ad052f72a6c994dfb2fe0aa11970c9d110564004 Mon Sep 17 00:00:00 2001
From: Jake Vanderwerf <get@jakevanderwerf.ca>
Date: Tue, 10 Feb 2026 17:50:45 +0000
Subject: [PATCH] =Fix for FAQpage schema not outputting correctly, as well as Form.php status radios and editForm on CRUDSkeleton.php
---
inc/ui/CRUDSkeleton.php | 74 ++++++++++++++++++++++++++-----------
1 files changed, 52 insertions(+), 22 deletions(-)
diff --git a/inc/ui/CRUDSkeleton.php b/inc/ui/CRUDSkeleton.php
index 3fa2dc6..c32dcce 100644
--- a/inc/ui/CRUDSkeleton.php
+++ b/inc/ui/CRUDSkeleton.php
@@ -1543,15 +1543,9 @@
<input type="hidden" name="form-id" value="<?=uniqid('new-')?>" />
<input type="hidden" name="content" value="<?=$this->dataType?>" />
<div class="fields">
- <div class="field-group radio-options row" data-field="post_status" data-field-type="radio">
- <span>Status:</span>
- <?php
- $this->getApplicableStatuses('edit');
- ?>
- </div>
- <?php if (!$this->userCanPublish) { ?>
- <p class="description">Your account needs to be verified before you can publish content.</p>
- <?php }
+ <?php
+ echo Form::render('post_status', '', $this->getStatusFieldConfig('edit-'));
+
if (!empty($this->sections)) {
$tabs = [];
@@ -1576,7 +1570,6 @@
$tabs = false;
}
-
$fields = $this->fields;
if (!$this->isTimeline) {
$first = ['post_thumbnail', 'post_title', 'price'];
@@ -1586,9 +1579,8 @@
if ($tabs) {
$tabs['basic']['content'] .= Form::render($f, '', $fields[$f]);
} else {
- Form::render($f, '', $fields[$f]);
+ echo Form::render($f, '', $fields[$f]);
}
-
unset($fields[$f]);
}
}
@@ -1622,14 +1614,14 @@
$fields = $this->nonTimelineFields;
}
foreach ($fields as $n => $config) {
+ if (in_array($config['type'], ['taxonomy', 'selector'])) {
+ $config = array_merge($config, $this->taxConfig($config['taxonomy'], $config['label']));
+ }
if ($tabs) {
$section = (array_key_exists('section', $config)) ? $config['section'] : 'basic';
- $tabs[$section]['content'] .= Form::render($n,'', $config);
+ $tabs[$section]['content'] .= Form::render($n, '', $config);
} else {
- if (in_array($config['type'], ['taxonomy', 'selector'])) {
- $config = array_merge($config, $this->taxConfig($config['taxonomy'], $config['label']));
- }
- Form::render($n, '', $config);
+ echo Form::render($n, '', $config);
}
}
@@ -1664,12 +1656,9 @@
<p class="description">You can unselect items by clicking the image here.</p>
<p class="hint"><strong>IMPORTANT: </strong> Whatever changes you make here will be applied to all selected <?=$this->plural?>.</p>
<div class="fields">
- <div class="field-group radio-options row">
- <?php
- $this->getApplicableStatuses('bulk-');
- ?>
- </div>
<?php
+ echo Form::render('post_status', '', $this->getStatusFieldConfig('bulk-'));
+
if (!empty($this->taxonomies)) {
?>
<div class="taxonomies">
@@ -1706,7 +1695,46 @@
);
}
+ protected function getStatusFieldConfig(string $prefix): array
+ {
+ $options = [];
+ foreach ($this->statuses as $status) {
+ if ($status === 'all' || !array_key_exists($status, $this->allowedStatuses)) {
+ continue;
+ }
+ $config = $this->allowedStatuses[$status];
+
+ if (in_array($status, ['future', 'past'])) {
+ if ($status === 'future') {
+ $status = 'publish';
+ $config = ['icon' => 'eye', 'label' => 'Live'];
+ } else {
+ continue;
+ }
+ }
+
+ $options[$status] = [
+ 'label' => $config['label'],
+ 'icon' => $config['icon'],
+ 'disabled' => ($status === 'publish' && !$this->userCanPublish),
+ ];
+ }
+
+ return [
+ 'type' => 'radio',
+ 'label' => 'Status',
+ 'options' => $options,
+ 'inputClass' => 'btn',
+ 'idPrefix' => $prefix,
+ 'class' => 'radio-options row',
+ 'hint' => !$this->userCanPublish
+ ? 'Your account needs to be verified before you can publish content.'
+ : '',
+ ];
+ }
+
protected function getApplicableStatuses(string $prefix) {
+ ob_start();
foreach ($this->statuses as $status) {
if ($status === 'all' || !array_key_exists($status, $this->allowedStatuses)) {
continue;
@@ -1736,5 +1764,7 @@
</label>
<?php
}
+ $out = ob_get_clean();
+ echo Form::fieldWrap('post_status', $out, ['type'=>'group']);
}
}
--
Gitblit v1.10.0