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/goal.php |  159 ++++++++++++++++++++++++++++++++++++++++------------
 1 files changed, 121 insertions(+), 38 deletions(-)

diff --git a/taxonomies/goal.php b/taxonomies/goal.php
index c0dc2d0..a745df2 100644
--- a/taxonomies/goal.php
+++ b/taxonomies/goal.php
@@ -1,44 +1,127 @@
 <?php
 // /taxonomies/goal.php
-function altr_goal():array
+
+use JVBase\registrar\Registrar;
+if (!defined('ABSPATH')) {
+    exit;
+}
+
+add_action('jvbDefineRegistrar', 'altr_goal');
+add_action('jvbDefineRegistrarFields', 'altr_goal_fields');
+
+add_action('plugins_loaded', 'altr_goal',1);
+//Add fields later so we can verify taxonomies/post types exist
+add_action('plugins_loaded', 'altr_goal_fields', 2);
+
+add_filter('altr_GoalSchemaDefault', 'altr_goal_schema');
+add_filter('altr_GoalMetaDefault', 'altr_goal_meta');
+add_filter('altr_GoalArchiveDefault', 'altr_goal_archive');
+
+function altr_goal(){
+    if (!class_exists('JVBase\registrar\Registrar')) {
+        return;
+    }
+    $goal = Registrar::forTerm('goal', 'Goal', 'Goals')
+        ->setIcon('crosshair')
+        ->make([
+            'rewrite'   => [
+                'slug'          => 'before-and-after/by/goal',
+                'with_front'    => false,
+                'hierarchical'  => true
+            ],
+            'description'   => 'Complete tattoo removal or fading for a cover up tattoo (or unknown)',
+            'hierarchical' => true,
+            'for'    => [
+                'progress',
+            ],
+        ])
+        ->setAll([
+            'show_directory',
+            'show_feed',
+        ]);
+
+//$directory = $goal->getConfig('directory');
+
+}
+
+function altr_goal_fields():void
+{
+    if (!class_exists('JVBase\registrar\Registrar')) {
+        return;
+    }
+    $goal = Registrar::getInstance('goal');
+
+    $fields = $goal->fields();
+    $fields->addCommon('wiki');
+}
+
+function altr_goal_schema():array
 {
     return [
-        'singular'       => 'Goal',
-        'plural'         => 'Goals',
-        'icon'           => 'crosshair',
-        'description'    => [
-            'Complete tattoo removal or fading for a cover up tattoo (or unknown)'
-        ],
-        'show_feed'      => true,
-        'show_directory'=> true,
-        'rewrite'        => [
-            'slug'         => 'before-and-after/by/goal',
-            'with_front'   => false,
-        ],
-        'for_content'    => [
-            'progress',
-        ],
-        'seo' => [
-            'meta' => [
-                'title' => '{{term_name}} – Before & After Laser Tattoo Removal',
-                'description' => 'Before and after results for clients seeking {{term_name}}. See how PicoWay laser technology delivers results in Edmonton.',
-            ],
-            'schema' => [
-                'type' => 'CollectionPage',
-                'name' => '{{term_name}} Before & Afters',
-            ],
-            'archive' => [
-                'type' => 'CollectionPage',
-                'name' => '{{term_name}} – Laser Tattoo Removal Results',
-            ],
-        ],
-        'fields'         => [
-            'term_name' => [
-                'label'     => 'Name',
-                'type'      => 'text',
-                'quickEdit' => true,
-            ],
-            'common'    => [ 'wiki' ]
-        ]
+        'name'              => '{{name}} Laser Tattoo Removal Before & Afters',
     ];
 }
+
+function altr_goal_meta():array
+{
+    return[
+        'name'              => '{{name}} – Before & After Laser Tattoo Removal',
+        'description'       => 'Before and after results for clients seeking {{term_name}}. See how PicoWay laser technology delivers results in Edmonton.',
+    ];
+}
+
+function altr_goal_archive(array $defaults):array
+{
+    return array_merge($defaults, [
+        'name' => '{{name}} – Laser Tattoo Removal Results',
+    ]);
+}
+
+function altr_goal_reference_schema(array $defaults):array
+{
+    return $defaults;
+}
+
+//
+//function altr_goal():array
+//{
+//    return [
+//        'singular'       => 'Goal',
+//        'plural'         => 'Goals',
+//        'icon'           => 'crosshair',
+//        'description'    => [
+//            'Complete tattoo removal or fading for a cover up tattoo (or unknown)'
+//        ],
+//        'show_feed'      => true,
+//        'show_directory'=> true,
+//        'rewrite'        => [
+//            'slug'         => 'before-and-after/by/goal',
+//            'with_front'   => false,
+//        ],
+//        'for_content'    => [
+//            'progress',
+//        ],
+//        'seo' => [
+//            'meta' => [
+//                'title' => '{{term_name}} – Before & After Laser Tattoo Removal',
+//                'description' => 'Before and after results for clients seeking {{term_name}}. See how PicoWay laser technology delivers results in Edmonton.',
+//            ],
+//            'schema' => [
+//                'type' => 'CollectionPage',
+//                'name' => '{{term_name}} Before & Afters',
+//            ],
+//            'archive' => [
+//                'type' => 'CollectionPage',
+//                'name' => '{{term_name}} – Laser Tattoo Removal Results',
+//            ],
+//        ],
+//        'fields'         => [
+//            'term_name' => [
+//                'label'     => 'Name',
+//                'type'      => 'text',
+//                'quickEdit' => true,
+//            ],
+//            'common'    => [ 'wiki' ]
+//        ]
+//    ];
+//}

--
Gitblit v1.10.0