From aa974bf5954d0cca2506003a3cd9ec4eb89ed0bc Mon Sep 17 00:00:00 2001
From: Jake Vanderwerf <get@jakevanderwerf.ca>
Date: Mon, 11 May 2026 18:35:55 +0000
Subject: [PATCH] =Transfer to new Registrar system

---
 taxonomies/theme.php |  217 +++++++++++++++++++++++++++++++++++++++---------------
 1 files changed, 157 insertions(+), 60 deletions(-)

diff --git a/taxonomies/theme.php b/taxonomies/theme.php
index bbb2c21..8b7ec64 100644
--- a/taxonomies/theme.php
+++ b/taxonomies/theme.php
@@ -1,66 +1,163 @@
 <?php
 // /taxonomies/theme.php
-function altr_theme():array
+
+use JVBase\registrar\Registrar;
+if (!defined('ABSPATH')) {
+    exit;
+}
+
+add_action('jvbDefineRegistrar', 'altr_theme');
+add_action('jvbDefineRegistrarFields', 'altr_theme_fields');
+add_action('plugins_loaded', 'altr_theme',1);
+//Add fields later so we can verify taxonomies/post types exist
+add_action('plugins_loaded', 'altr_theme_fields', 2);
+
+add_filter('altr_ThemeSchemaDefault', 'altr_theme_schema');
+add_filter('altr_ThemeMetaDefault', 'altr_theme_meta');
+add_filter('altr_ThemeArchiveDefault', 'altr_theme_archive');
+
+function altr_theme(){
+    if (!class_exists('JVBase\registrar\Registrar')) {
+        return;
+    }
+    $theme = Registrar::forTerm('theme', 'Theme', 'Themes')
+        ->setIcon('hash')
+        ->make([
+            'rewrite'   => [
+                'slug'          => 'before-and-after/by/themes',
+                'with_front'    => false,
+                'hierarchical'  => true
+            ],
+            'description'   => 'What makes up the tattoo, asides from style. From bees to ideas to carrots.',
+            'hierarchical' => true,
+            'for'    => [
+                'progress',
+            ],
+        ])
+        ->setAll([
+            'show_directory',
+            'show_feed',
+        ]);
+
+//$directory = $theme->getConfig('directory');
+
+}
+
+function altr_theme_fields():void
+{
+    if (!class_exists('JVBase\registrar\Registrar')) {
+        return;
+    }
+    $theme = Registrar::getInstance('theme');
+
+    $fields = $theme->fields();
+    $fields->addField('similar', [
+        'type'  => 'selector',
+        'subtype'=> 'taxonomy',
+        'isReference'=> true,
+        'taxonomy'  => 'theme',
+        'label' => 'Similar Themes'
+    ]);
+    $fields->addField('archive_title', [
+        'type'  => 'text',
+        'label' => 'Archive Title',
+        'hint'  => 'If the generated title does not jive, set it here'
+    ]);
+    $fields->addCommon('wiki');
+    $fields->addCommon('alternate_name');
+    $fields->addCommon('keywords');
+}
+
+function altr_theme_schema():array
 {
     return [
-        'directory'    => 'Themes',
-        'show_directory' => true,
-        'isGrouped'     => true,
-        'description'    => [
-            'What makes up the tattoo, asides from style.',
-            'From bees to ideas to carrots.'
-        ],
-        'singular'     => 'Theme',
-        'plural'       => 'Themes',
-        'icon'         => 'hash',
-        'show_feed'    => true,
-        'rewrite'      => [
-            'slug'         => 'before-and-after/by/themes',
-            'with_front'   => false,
-            'hierarchical' => true,
-        ],
-        'hierarchical' => true,
-        'for_content'  => [
-            'progress',
-        ],
-        'seo' => [
-            'meta' => [
-                'title' => '{{term_name}} Tattoo Removal – Before & After Photos',
-                'description' => 'Before and after photos of {{term_name}} tattoo removal by laser in Edmonton.',
-            ],
-            'schema' => [
-                'type' => 'CollectionPage',
-                'name' => '{{term_name}} Tattoo Removal Before & Afters',
-                'description' => '{{term_description}}',
-            ],
-            'archive' => [
-                'type' => 'CollectionPage',
-                'name' => '{{term_name}} Tattoo Removal – Before & After Gallery',
-            ],
-        ],
-        'fields'       => [
-            'term_name'       => [
-                'label'     => 'Name',
-                'type'      => 'text',
-                'quickEdit' => true,
-            ],
-            'similar'         => [
-                'type'          => 'taxonomy',
-                'taxonomy_type' => 'reference',
-                'taxonomy'      => 'theme',
-                'label'         => 'Similar Themes',
-            ],
-            'description'     => [
-                'type'  => 'textarea',
-                'quill' => true,
-                'label' => 'Description',
-            ],
-            'archive_title'   => [
-                'type'        => 'text',
-                'label'       => 'Archive Title',
-                'description' => 'If the generated title does not jive, set it here',
-            ],
-            'common'          => [ 'wiki', 'alternate_name', 'keywords' ]
-        ]
+        'name'              => 'How to remove {{name}} tattoos',
+        'description'       => '{{description}}'
     ];
 }
+
+function altr_theme_meta():array
+{
+    return[
+        'name'              => 'How to remove {{name}} tattoos',
+        'description'       => '{{description}}'
+    ];
+}
+
+function altr_theme_archive(array $defaults):array
+{
+    return array_merge($defaults, [
+        'name' => 'How to remove {{name}} tattoos',
+    ]);
+}
+
+function altr_theme_reference_schema(array $defaults):array
+{
+    return $defaults;
+}
+
+//
+//function altr_theme():array
+//{
+//    return [
+//        'directory'    => 'Themes',
+//        'show_directory' => true,
+////        'isGrouped'     => true,
+//        'description'    => [
+//            'What makes up the tattoo, asides from style.',
+//            'From bees to ideas to carrots.'
+//        ],
+//        'singular'     => 'Theme',
+//        'plural'       => 'Themes',
+//        'icon'         => 'hash',
+//        'show_feed'    => true,
+//        'rewrite'      => [
+//            'slug'         => 'before-and-after/by/themes',
+//            'with_front'   => false,
+//            'hierarchical' => true,
+//        ],
+//        'hierarchical' => true,
+//        'for_content'  => [
+//            'progress',
+//        ],
+//        'seo' => [
+//            'meta' => [
+//                'title' => '{{term_name}} Tattoo Removal – Before & After Photos',
+//                'description' => 'Before and after photos of {{term_name}} tattoo removal by laser in Edmonton.',
+//            ],
+//            'schema' => [
+//                'type' => 'CollectionPage',
+//                'name' => '{{term_name}} Tattoo Removal Before & Afters',
+//                'description' => '{{term_description}}',
+//            ],
+//            'archive' => [
+//                'type' => 'CollectionPage',
+//                'name' => '{{term_name}} Tattoo Removal – Before & After Gallery',
+//            ],
+//        ],
+//        'fields'       => [
+//            'term_name'       => [
+//                'label'     => 'Name',
+//                'type'      => 'text',
+//                'quickEdit' => true,
+//            ],
+//            'similar'         => [
+//                'type'          => 'taxonomy',
+//                'taxonomy_type' => 'reference',
+//                'taxonomy'      => 'theme',
+//                'label'         => 'Similar Themes',
+//            ],
+//            'description'     => [
+//                'type'  => 'textarea',
+//                'quill' => true,
+//                'label' => 'Description',
+//            ],
+//            'archive_title'   => [
+//                'type'        => 'text',
+//                'label'       => 'Archive Title',
+//                'description' => 'If the generated title does not jive, set it here',
+//            ],
+//            'common'          => [ 'wiki', 'alternate_name', 'keywords' ]
+//        ]
+//    ];
+//}

--
Gitblit v1.10.0