From 3f08cede4c4e71244a5c5f8f6cfe1ce98e5e908b Mon Sep 17 00:00:00 2001
From: Jake Vanderwerf <get@jakevanderwerf.ca>
Date: Sun, 26 Apr 2026 22:06:20 +0000
Subject: [PATCH] =Switching to new jvb system

---
 content/soap.php |  226 +++++++++++++++++++++++++++++++++++++++++---------------
 1 files changed, 164 insertions(+), 62 deletions(-)

diff --git a/content/soap.php b/content/soap.php
index 75507ea..c70c373 100644
--- a/content/soap.php
+++ b/content/soap.php
@@ -1,69 +1,171 @@
 <?php
 // /content/soap.php
-function atat_soap():array
+
+use JVBase\registrar\Registrar;
+if (!defined('ABSPATH')) {
+    exit;
+}
+
+
+add_action('jvbDefineRegistrar', 'atat_soap');
+add_action('jvbDefineRegistrarFields', 'atat_soap_fields');
+
+add_action('plugins_loaded', 'atat_soap',3);
+//Add fields later so we can verify taxonomies/post types exist
+add_action('plugins_loaded', 'atat_soap_fields', 4);
+
+add_filter('atat_FaqSchemaDefault', 'atat_soap_schema');
+add_filter('atat_FaqMetaDefault', 'atat_soap_meta');
+add_filter('atat_FaqArchiveDefault', 'atat_soap_archive');
+
+function atat_soap(){
+    if (!class_exists('JVBase\registrar\Registrar')) {
+        return;
+    }
+    $soap = Registrar::forPost('soap', 'Soap', 'Soaps')
+        ->setIcon('sparkle')
+        ->make([
+            'rewrite'   => [
+                'slug'          => 'soap',
+                'with_front'    => false,
+            ],
+            'taxonomies'    => [
+                'flag',
+            ],
+            'public'    => false,
+        ])
+        ->setAll([
+            'show_directory',
+        ])
+        ->setIntegration('helcim')
+        ->setIntegration('facebook')
+        ->setIntegration('instagram');
+
+//$directory = $soap->getConfig('directory');
+
+}
+
+function atat_soap_fields():void
+{
+    if (!class_exists('JVBase\registrar\Registrar')) {
+        return;
+    }
+    $soap = Registrar::getInstance('soap');
+//    $breadcrumbs = $soap->config('breadcrumbs');
+//    $breadcrumbs->setCrumb('section');
+
+
+    $fields = $soap->fields();
+    $fields->addField('ingredients', [
+        'type'      => 'textarea',
+        'quill'     => true,
+        'label'     => 'Ingredients',
+    ]);
+    $fields->addField('extra_info', [
+        'type'      => 'textarea',
+        'quill'     => true,
+        'label'     => 'Extra Info',
+    ]);
+    $fields->addField('flag', [
+        'type'      => 'selector',
+        'subtype'   => 'taxonomy',
+        'taxonomy'  => 'flag',
+        'label'     => 'Flags',
+    ]);
+}
+
+function atat_soap_schema():array
 {
     return [
-        'singular'       => 'Soap',
-        'plural'       => 'Soaps',
-        'dash_title'    => 'Soap',
-        'dash_description' => 'Manage your soap',
-        'breadcrumb'    => 'Soap',
-        'icon'         => 'sparkle',
-		'integrations'	=> [
-			'helcim'	=> [
-				'initial'	=> true,
-				'update'	=> true,
-			],
-		],
-        'rewrite'      => [
-            'slug'       => 'soap',
-            'with_front' => false,
-        ],
-        'fields'       => [
-            'post_title'     => [
-                'type'  => 'text',
-                'label' => 'Name',
-            ],
-            'post_status'         => [
-                'type'      => 'radio',
-                'label'     => 'Status',
-                'hidden'    => true,
-                'options'   => [
-                    'publish'   => 'Show',
-                    'draft'     => 'Hide',
-                    'trash'     => 'Scrap',
-                    'delete'    => 'Permanently Delete'
-                ]
-            ],
-            'post_slug' => [
-                'type'  => 'text',
-                'label' => 'Slug',
-				'hidden'	=> true,
-            ],
-            'post_content'        => [
-                'type'  => 'textarea',
-                'label' => 'Description',
-                'quill' => true,
-            ],
-            'ingredients' => [
-                'type'  => 'textarea',
-                'label' => 'Ingredients',
-				'quill'	=> true,
-            ],
-            'extra_info' => [
-                'type'  => 'textarea',
-                'label' => 'Extra Info',
-				'quill'	=> true,
-            ],
-            'flags'  => [
-                'type'  => 'taxonomy',
-				'taxonomy'	=> 'flags',
-                'term'	=> 'flags',
-                'label'	=> 'Flags',
-            ]
-        ],
-        'single_image' => true,
-        'upload_title' => 'Upload Soaps',
+        'type'              => 'JVBase\managers\SEO\render\Thing\Product\Product',
+        'name'              => '{{post_title}} | Handmade in Edmonton',
     ];
 }
 
+function atat_soap_meta():array
+{
+    return[
+        'name' => '{{post_title}} | Handmade in Edmonton',
+    ];
+}
+
+function atat_soap_archive(array $defaults):array
+{
+    return array_merge($defaults, [
+        'name' => 'Handmade Soaps',
+        'description' => 'Handmade Soaps in Edmonton, Alberta.'
+    ]);
+}
+
+function atat_soap_reference_schema(array $defaults):array
+{
+    return $defaults;
+}
+// /content/soap.php
+//function atat_soap():array
+//{
+//    return [
+//        'singular'       => 'Soap',
+//        'plural'       => 'Soaps',
+//        'dash_title'    => 'Soap',
+//        'dash_description' => 'Manage your soap',
+//        'breadcrumb'    => 'Soap',
+//        'icon'         => 'sparkle',
+//		'integrations'	=> [
+//			'helcim'	=> [
+//				'initial'	=> true,
+//				'update'	=> true,
+//			],
+//		],
+//        'rewrite'      => [
+//            'slug'       => 'soap',
+//            'with_front' => false,
+//        ],
+//        'fields'       => [
+//            'post_title'     => [
+//                'type'  => 'text',
+//                'label' => 'Name',
+//            ],
+//            'post_status'         => [
+//                'type'      => 'radio',
+//                'label'     => 'Status',
+//                'hidden'    => true,
+//                'options'   => [
+//                    'publish'   => 'Show',
+//                    'draft'     => 'Hide',
+//                    'trash'     => 'Scrap',
+//                    'delete'    => 'Permanently Delete'
+//                ]
+//            ],
+//            'post_slug' => [
+//                'type'  => 'text',
+//                'label' => 'Slug',
+//				'hidden'	=> true,
+//            ],
+//            'post_content'        => [
+//                'type'  => 'textarea',
+//                'label' => 'Description',
+//                'quill' => true,
+//            ],
+//            'ingredients' => [
+//                'type'  => 'textarea',
+//                'label' => 'Ingredients',
+//				'quill'	=> true,
+//            ],
+//            'extra_info' => [
+//                'type'  => 'textarea',
+//                'label' => 'Extra Info',
+//				'quill'	=> true,
+//            ],
+//            'flags'  => [
+//                'type'  => 'taxonomy',
+//				'taxonomy'	=> 'flags',
+//                'term'	=> 'flags',
+//                'label'	=> 'Flags',
+//            ]
+//        ],
+//        'single_image' => true,
+//        'upload_title' => 'Upload Soaps',
+//    ];
+//}
+

--
Gitblit v1.10.0