From 4089ba01e0881c89a72332e13bc3a80b6bddec2a Mon Sep 17 00:00:00 2001
From: Jake Vanderwerf <get@jakevanderwerf.ca>
Date: Mon, 29 Jun 2026 22:15:55 +0000
Subject: [PATCH] =DashboardManager overhaul. A bit easier to modify the output of pages. Still have to get the account pages to work as expected, as well as verify the integrations and others are working - but registrar/content pages work as expected. Also fixed up the table generation in CRUD.js and CRUDSkeleton.php
---
inc/managers/SEO/SEOAdminPage.php | 54 +++++++++++++++++++++++++-----------------------------
1 files changed, 25 insertions(+), 29 deletions(-)
diff --git a/inc/managers/SEO/SEOAdminPage.php b/inc/managers/SEO/SEOAdminPage.php
index 93dea24..bf0ef02 100644
--- a/inc/managers/SEO/SEOAdminPage.php
+++ b/inc/managers/SEO/SEOAdminPage.php
@@ -2,7 +2,8 @@
namespace JVBase\managers\SEO;
use JVBase\managers\AdminPages;
-use JVBase\meta\MetaForm;
+use JVBase\meta\Form;
+use JVBase\registrar\Registrar;
use JVBase\ui\Tabs;
if (!defined('ABSPATH')) {
@@ -18,17 +19,15 @@
*/
class SEOAdminPage
{
- private ConfigManager $config;
- private SchemaBuilder $registry;
- private MetaForm $form;
+// private SchemaBuilder $registry;
public function __construct()
{
- $this->registry = SchemaBuilder::getInstance();
- $this->form = new MetaForm();
+// $this->registry = SchemaBuilder::getInstance();
// Add to JVB dashboard
+ add_action(BASE.'dashboardPage', [$this, 'addDashboardSection'], 10, 1);
add_filter('jvbDashboardPage', [$this, 'addDashboardSection'], 20, 2);
add_action('admin_enqueue_scripts', [$this, 'enqueueScripts']);
}
@@ -62,14 +61,13 @@
/**
* Add section to JVB dashboard
*/
- public function addDashboardSection(string $content, string $page): string
+ public function addDashboardSection(string $page):void
{
- if ($page !== 'SEO') {
- return $content;
+ jvbDump($page);
+ if ($page !== 'seo') {
+ return;
}
- ob_start();
$this->renderAdminPage();
- return ob_get_clean();
}
/**
@@ -148,8 +146,10 @@
echo '<div class="seo-'.$type.'">';
}
$fieldConfig = $this->registry->getFieldDefinition($fieldName);
-
- $this->form->render($fieldName, $config[$fieldName]??'', $fieldConfig);
+ if (!$fieldConfig) {
+ continue;
+ }
+ echo Form::render($fieldName, $config[$fieldName]??'', $fieldConfig);
if ($index === 0 && $fieldName === 'type') {
echo '<div class="seo-'.$type.'">';
}
@@ -192,23 +192,16 @@
{
$types = ['meta', 'schema'];
- switch ($type) {
- case 'content':
- $config = JVB_CONTENT;
- $types[] = 'archive';
- break;
- case 'taxonomy':
- case 'taxonomies':
- $config = JVB_TAXONOMY;
- break;
- case 'user':
- $config = JVB_USER;
- break;
- default:
- error_log('[SEOAdminPage]:renderConfig --- no config found for '.$type);
- return '';
+ if ($type == 'content') {
+ $types[] = 'archive';
}
+ $registrar = Registrar::getInstance($type);
+ if (!$registrar){
+ return '';
+ }
+ $config = $registrar->getConfig('seo');
+
$mainTabs = new Tabs();
foreach ($config as $c => $opt) {
@@ -269,7 +262,10 @@
$fields = $this->registry->getFieldsForType($type);
foreach ($fields as $fieldName) {
$config = $this->registry->getFieldDefinition($fieldName);
- $this->form->render($fieldName, '', $config);
+ if (!$config) {
+ continue;
+ }
+ echo Form::render($fieldName, '', $config);
}
?>
</div>
--
Gitblit v1.10.0