From f383c3a4325bc173b6f9676274bc19694be6f9c0 Mon Sep 17 00:00:00 2001
From: Jake Vanderwerf <get@jakevanderwerf.ca>
Date: Fri, 05 Jun 2026 16:49:44 +0000
Subject: [PATCH] =Modified the Feed Fields config in Registrar, to utilize the built in functionality there

---
 content/terms.php |  255 +++++++++++++++++++++++++++++++++++++--------------
 1 files changed, 185 insertions(+), 70 deletions(-)

diff --git a/content/terms.php b/content/terms.php
index 2073b1d..92d6593 100644
--- a/content/terms.php
+++ b/content/terms.php
@@ -1,77 +1,192 @@
 <?php
 // /content/terms.php
-function altr_terms():array
+
+use JVBase\registrar\Registrar;
+if (!defined('ABSPATH')) {
+    exit;
+}
+
+
+add_action('jvbDefineRegistrar', 'altr_terms');
+add_action('jvbDefineRegistrarFields', 'altr_terms_fields');
+
+add_action('plugins_loaded', 'altr_terms',1);
+//Add fields later so we can verify taxonomies/post types exist
+add_action('plugins_loaded', 'altr_terms_fields', 2);
+
+add_filter('altr_TermsSchemaDefault', 'altr_terms_schema');
+add_filter('altr_TermsMetaDefault', 'altr_terms_meta');
+add_filter('altr_TermsArchiveDefault', 'altr_terms_archive');
+
+function altr_terms(){
+    if (!class_exists('JVBase\registrar\Registrar')) {
+        return;
+    }
+    $terms = Registrar::forPost('terms', 'Term', 'Terms')
+        ->setIcon('asterisk')
+        ->make([
+            'rewrite'   => [
+                'slug'          => 'glossary',
+                'with_front'    => false,
+            ],
+            'taxonomies'    => [
+                'section',
+            ]
+        ])
+        ->setAll([
+            'show_directory',
+            'hide_single',
+            'is_glossary',
+        ]);
+
+//$directory = $terms->getConfig('directory');
+
+}
+
+function altr_terms_fields():void
+{
+    if (!class_exists('JVBase\registrar\Registrar')) {
+        return;
+    }
+    $terms = Registrar::getInstance('terms');
+
+    $fields = $terms->fields();
+    $fields->addField('pronunciation', [
+        'type'      => 'repeater',
+        'label'     => 'Pronunciation',
+        'fields'    => [
+            'part'  => [
+                'type'  => 'text',
+                'label' => 'Part',
+            ]
+        ]
+    ]);
+    $fields->addField('type', [
+        'type'  => 'radio',
+        'label' => 'Type',
+        'options'   => [
+            'adjective',
+            'noun',
+            'verb'
+        ]
+    ]);
+
+    $dashboard = $terms->config('dashboard');
+    $dashboard->setTitle('Glossary');
+    $dashboard->setDescription('Manage your terms');
+
+
+}
+
+function altr_terms_schema():array
 {
     return [
-        'singular'       => 'Term',
-        'plural'       => 'Terms',
-        'dash_title'    => 'Glossary',
-        'dash_description' => 'Manage your terms',
-        'breadcrumb'    => 'Glossary',
-        'hide_single'  => true,
-        'icon'         => 'asterisk',
-        'is_gallery'    => true,
-        'seo' => [
-            'schema' => [
-                'type'  => 'DefinedTerm',
-                'name'  => '{{post_title}}',
-                'description' => '{{post_content}}'
-            ],
-            'archive' => [
-                'type'  => 'DefinedTermSet',
-            ]
-        ],
-        'rewrite'      => [
-            'slug'       => 'glossary',
-            'with_front' => false,
-        ],
-        'fields'       => [
-            'post_title'     => [
-                'type'  => 'text',
-                'label' => 'Title',
-            ],
-            'post_status'         => [
-                'type'      => 'radio',
-                'label'     => 'Status',
-                'hidden'    => true,
-                'options'   => [
-                    'publish'   => 'Show',
-                    'draft'     => 'Hide',
-                    'trash'     => 'Scrap',
-                    'delete'    => 'Permanently Delete'
-                ]
-            ],
-            'post_slug' => [
-                'type'  => 'text',
-                'label' => 'Slug'
-            ],
-            'post_content'        => [
-                'type'  => 'textarea',
-                'label' => 'Definition',
-                'quill' => true,
-            ],
-            'pronunciation' => [
-                'type'  => 'repeater',
-                'label' => 'Pronunciation',
-                'fields' => [
-                    'part'  => [
-                        'type'  => 'text',
-                        'label' => 'Part',
-                    ]
-                ]
-            ],
-            'type'  => [
-                'type'  => 'radio',
-                'label' => 'Type',
-                'options' => [
-                    'adjective',
-                    'noun',
-                    'verb'
-                ]
-            ]
-        ],
-        'single_image' => false,
-        'upload_title' => 'Upload Before & Afters',
+        'type'              => 'JVBase\managers\SEO\render\Thing\Intangible\DefinedTerm',
+        'name'              => '{{post_title}} | What it Means',
+        'description'       => '{{post_content}}'
     ];
 }
 
+function altr_terms_meta():array
+{
+    return[
+        'name' => '{{post_title}} | What it Means',
+    ];
+}
+
+
+function altr_terms_archive(array $defaults):array
+{
+    return array_merge($defaults, [
+        'mainEntity' => [
+            'type'  => 'JVBase\managers\SEO\render\Thing\CreativeWork\DefinedTermSet',
+            'id'    => 'glossary-of-terms',
+            'name' => 'Glossary of Terms',
+            'description' => 'Brief definitions of terms and how they relate with laser tattoo removal.'
+        ],
+
+        'name' => 'Glossary of Terms',
+        'description' => 'Brief definitions of terms and how they relate with laser tattoo removal.'
+    ]);
+}
+
+function altr_terms_reference_schema(array $defaults):array
+{
+    return $defaults;
+}
+//
+//function altr_terms():array
+//{
+//    return [
+//        'singular'       => 'Term',
+//        'plural'       => 'Terms',
+//        'dash_title'    => 'Glossary',
+//        'dash_description' => 'Manage your terms',
+//        'breadcrumb'    => 'Glossary',
+//        'hide_single'  => true,
+//        'icon'         => 'asterisk',
+//        'is_gallery'    => true,
+//        'seo' => [
+//            'schema' => [
+//                'type'  => 'DefinedTerm',
+//                'name'  => '{{post_title}}',
+//                'description' => '{{post_content}}'
+//            ],
+//            'archive' => [
+//                'type'  => 'DefinedTermSet',
+//            ]
+//        ],
+//        'rewrite'      => [
+//            'slug'       => 'glossary',
+//            'with_front' => false,
+//        ],
+//        'fields'       => [
+//            'post_title'     => [
+//                'type'  => 'text',
+//                'label' => 'Title',
+//            ],
+//            'post_status'         => [
+//                'type'      => 'radio',
+//                'label'     => 'Status',
+//                'hidden'    => true,
+//                'options'   => [
+//                    'publish'   => 'Show',
+//                    'draft'     => 'Hide',
+//                    'trash'     => 'Scrap',
+//                    'delete'    => 'Permanently Delete'
+//                ]
+//            ],
+//            'post_slug' => [
+//                'type'  => 'text',
+//                'label' => 'Slug'
+//            ],
+//            'post_content'        => [
+//                'type'  => 'textarea',
+//                'label' => 'Definition',
+//                'quill' => true,
+//            ],
+//            'pronunciation' => [
+//                'type'  => 'repeater',
+//                'label' => 'Pronunciation',
+//                'fields' => [
+//                    'part'  => [
+//                        'type'  => 'text',
+//                        'label' => 'Part',
+//                    ]
+//                ]
+//            ],
+//            'type'  => [
+//                'type'  => 'radio',
+//                'label' => 'Type',
+//                'options' => [
+//                    'adjective',
+//                    'noun',
+//                    'verb'
+//                ]
+//            ]
+//        ],
+//        'single_image' => false,
+//        'upload_title' => 'Upload Before & Afters',
+//    ];
+//}
+

--
Gitblit v1.10.0