From a17c578433ef543e220697813a9367a260df83e1 Mon Sep 17 00:00:00 2001
From: Jake Vanderwerf <get@jakevanderwerf.ca>
Date: Thu, 28 May 2026 19:14:31 +0000
Subject: [PATCH] =new gitblit setup

---
 content/art.php |  615 +++++++++++++++++++++++++++++++++++++------------------
 1 files changed, 414 insertions(+), 201 deletions(-)

diff --git a/content/art.php b/content/art.php
index 9b4abaa..b5dff8e 100644
--- a/content/art.php
+++ b/content/art.php
@@ -1,190 +1,354 @@
 <?php
 // /content/art.php
 use JVBase\meta\Meta;
+use JVBase\registrar\Registrar;
+use JVBase\utility\Image;
 
-function ajv_art():array
-{
-    return [
-        'singular'       => 'Art',
-        'plural'       => 'Art',
-        'dash_title'    => 'Art',
-        'dash_description' => 'Manage your art posts',
-        'directory' => 'Art',
-        'breadcrumb'    => 'Art',
-        'addCrumb'  => 'form',
-        'hide_single'  => false,
-        'show_feed'    => true,
-        'show_directory'=> true,
-        'favouritable' => true,
-        'karma'        => false,
-        'icon'         => 'palette',
-        'seo' => [
-            'schema' => [
-                'type' => 'VisualArtwork',
-                'name' => '{{post_title}}',
-                'description' => '{{post_excerpt}}',
-                'about' => ['@id' => '{{site_url}}/#art'],
-                'associatedMedia' => '{{post_thumbnail}}',
-                'dateCreated' => '{{post_date}}',
-                // artform, artMedium, creator, keywords auto-enriched by VisualArtworkResolver
-            ],
-            'meta' => [
-                'title' => '{{post_title}} — {{form.name}} Art | Handmade. Human.',
-                'description' => '{{post_excerpt}}',
-            ],
-            'archive' => [
-                'type' => 'CollectionPage',
-                'name' => 'Canadian Art. Made in Edmonton, Alberta.',
-                'description' => 'Handmade sculpture, jewelry, and more from Edmonton, Alberta.',
-            ],
-        ],
-        'feed'      => [
-            'single'    => [
-                'pre_title' => 'Canadian Art. Made in Edmonton, Alberta.',
-            ],
-            'archive'   => [
-
-            ],
-            'config'    => [
-                'is_gallery'    => false,
-                'content'       => 'art',
-                'context'       => 'art',
-                'id'            => [],
-                'class'         => [],
-            ]
-        ],
-        'rewrite'      => [
-            'slug'       => 'art',
-            'with_front' => false,
-        ],
-
-        'fields'       => [
-            'post_status'         => [
-                'type'      => 'radio',
-                'label'     => 'Status',
-                'options'   => [
-                    'publish'   => 'Show',
-                    'draft'     => 'Hide',
-                    'trash'     => 'Scrap',
-                    'delete'    => 'Permanently Delete'
-                ],
-                'hidden'    => true,
-            ],
-            'post_title'     => [
-                'type'  => 'text',
-                'label' => 'Title',
-            ],
-            'post_date' => [
-                'type'  => 'date',
-                'label' => 'Date',
-            ],
-            'city'  => [
-                'type'  => 'taxonomy',
-                'taxonomy'  => 'city',
-                'autocomplete'  => true,
-                'label' => 'City',
-            ],
-            'form'  => [
-                'type'  => 'taxonomy',
-                'taxonomy'  => 'form',
-                'autocomplete'  => true,
-                'label' => 'Art Form',
-            ],
-            'media'  => [
-                'type'  => 'taxonomy',
-                'taxonomy'  => 'media',
-                'autocomplete'  => true,
-                'label' => 'Media',
-            ],
-            'style'  => [
-                'type'  => 'taxonomy',
-                'taxonomy'  => 'style',
-                'autocomplete'  => true,
-                'label' => 'Style',
-            ],
-            'theme'  => [
-                'type'  => 'taxonomy',
-                'taxonomy'  => 'theme',
-                'autocomplete'  => true,
-                'label' => 'Theme',
-            ],
-            'project'  => [
-                'type'  => 'taxonomy',
-                'taxonomy'  => 'project',
-                'autocomplete'  => true,
-                'label' => 'Project',
-            ],
-            'post_thumbnail' => [
-                'type'  => 'upload',
-                'label' => 'Image',
-            ],
-            'gallery'        => [
-                'type'  => 'upload',
-                'multiple'=> 'true',
-                'label' => 'Gallery',
-            ],
-            'price'          => [
-                'type'  => 'number',
-                'label' => 'Price',
-            ],
-            'post_excerpt'  => [
-                'type'  => 'textarea',
-                'label' => 'Short Blurb',
-            ],
-            'post_content'   => [
-                'type'  => 'textarea',
-                'quill' => true,
-                'label' => 'Notes'
-            ],
-            'needs' => [
-                'type'  => 'repeater',
-                'label' => 'Needs',
-                'fields'=> [
-                    'need' => [
-                        'type' => 'text',
-                        'label' => 'Need',
-                        'required' => true
-                    ],
-                    'image' => [
-                        'type'  => 'upload',
-                        'multiple' => true,
-                        'label' => 'Example Image'
-                    ],
-                    'fulfilled' => [
-                        'type'  => 'textarea',
-                        'quill' => true,
-                        'label' => 'How I fulfilled it'
-                    ]
-                ]
-            ],
-            'wants' => [
-                'type'  => 'repeater',
-                'label' => 'Wants',
-                'fields'=> [
-                    'need' => [
-                        'type' => 'text',
-                        'label' => 'Want',
-                        'required' => true
-                    ],
-                    'image' => [
-                        'type'  => 'upload',
-                        'multiple' => true,
-                        'label' => 'Example Image'
-                    ],
-                    'fulfilled' => [
-                        'type'  => 'textarea',
-                        'quill' => true,
-                        'label' => 'How I fulfilled it'
-                    ]
-                ]
-            ],
-        ],
-        'single_image' => false,
-        'upload_title' => 'Upload Artwork',
-    ];
+if (!defined('ABSPATH')) {
+    exit;
 }
 
-function ajv_render_art_content(array $block, string $content):string
+
+add_action('plugins_loaded', 'ajv_art',1);
+//Add fields later so we can verify taxonomies/post types exist
+add_action('plugins_loaded', 'ajv_art_fields', 2);
+//add_action('init', 'ajv_art_extra_schema', 10);
+
+add_filter('ajv_ArtSchemaDefault', 'ajv_art_schema');
+add_filter('ajv_ArtMetaDefault', 'ajv_art_meta');
+add_filter('ajv_ArtArchiveDefault', 'ajv_art_archive');
+add_filter('ajv_ArtExtras', 'ajv_art_extras');
+
+function ajv_art(){
+    if (!class_exists('JVBase\registrar\Registrar')) {
+        return;
+    }
+    $art = Registrar::forPost('art', 'Art', 'Art')
+//        ->setIcon('palette')
+        ->setIcon('palette')
+        ->make([
+            'rewrite'   => [
+                'slug'          => 'art',
+                'with_front'    => false,
+            ],
+            'taxonomies'    => [
+                'project',
+                'form',
+                'city',
+                'media',
+                'style',
+                'theme'
+            ]
+        ])
+        ->setAll([
+            'show_feed',
+            'show_directory',
+            'favouritable'
+        ]);
+
+//$directory = $art->getConfig('directory');
+}
+
+function ajv_art_fields():void
+{
+    if (!class_exists('JVBase\registrar\Registrar')) {
+        return;
+    }
+    $art = Registrar::getInstance('art');
+    $breadcrumbs = $art->config('breadcrumbs');
+    $breadcrumbs->setCrumb(['project', 'form']);
+
+    $fields = $art->fields();
+    $fields->addField('project', [
+        'type'      => 'selector',
+        'subtype'   => 'taxonomy',
+        'taxonomy'  => 'project',
+        'label'     => 'Project',
+    ]);
+    $fields->addField('form', [
+        'type'      => 'selector',
+        'subtype'   => 'taxonomy',
+        'taxonomy'  => 'form',
+        'label'     => 'Form',
+    ]);
+    $fields->addField('city', [
+        'type'      => 'selector',
+        'subtype'   => 'taxonomy',
+        'taxonomy'  => 'city',
+        'label'     => 'City',
+    ]);
+    $fields->addField('media', [
+        'type'      => 'selector',
+        'subtype'   => 'taxonomy',
+        'taxonomy'  => 'media',
+        'label'     => 'Media',
+    ]);
+    $fields->addField('style', [
+        'type'      => 'selector',
+        'subtype'   => 'taxonomy',
+        'taxonomy'  => 'style',
+        'label'     => 'Style',
+    ]);
+    $fields->addField('theme', [
+        'type'      => 'selector',
+        'subtype'      => 'taxonomy',
+        'taxonomy'  => 'theme',
+        'label'     => 'Theme',
+    ]);
+    $fields->addField('gallery', [
+        'type'      => 'upload',
+        'multiple'  => true,
+        'label'     => 'Gallery',
+    ]);
+    $fields->addField('price', [
+        'type'      => 'number',
+        'label'     => 'Price',
+    ]);
+    $fields->addField('needs', [
+        'type'       => 'repeater',
+        'label'      => 'Needs',
+        'fields'     => [
+            'need' => [
+                'type' => 'text',
+                'label' => 'Need',
+                'required' => true
+            ],
+            'image' => [
+                'type'  => 'upload',
+                'multiple' => true,
+                'label' => 'Example Image'
+            ],
+            'fulfilled' => [
+                'type'  => 'textarea',
+                'quill' => true,
+                'label' => 'How I fulfilled it'
+            ]
+        ]
+    ]);
+    $fields->addField('wants', [
+        'type'       => 'repeater',
+        'label'      => 'Wants',
+        'fields'     => [
+            'need' => [
+                'type' => 'text',
+                'label' => 'Need',
+                'required' => true
+            ],
+            'image' => [
+                'type'  => 'upload',
+                'multiple' => true,
+                'label' => 'Example Image'
+            ],
+            'fulfilled' => [
+                'type'  => 'textarea',
+                'quill' => true,
+                'label' => 'How I fulfilled it'
+            ]
+        ]
+    ]);
+}
+
+function ajv_art_extras(array $extras):array
+{
+    return [[
+        'type'          => 'JVBase\managers\SEO\render\Thing\Intangible\Service',
+        'id'            => get_post_type_archive_link(BASE.'art').'#service',
+        'name'          => 'Art Created in Edmonton, Alberta',
+        'description'   => 'Handmade art by Canadian artist Jake Vanderwerf.',
+        'url'           => get_post_type_archive_link(BASE.'art'),
+        'provider'      => ['id' => get_home_url(null, '#localbusiness')],
+        'areaServed'    => [
+            '@type' => 'JVBase\managers\SEO\render\Thing\Place\AdministrativeArea\Country',
+            'name'  => 'Canada'
+        ],
+    ]];
+
+}
+
+
+//function ajv_art():array
+//{
+//    return [
+//        'singular'       => 'Art',
+//        'plural'       => 'Art',
+//        'dash_title'    => 'Art',
+//        'dash_description' => 'Manage your art posts',
+//        'directory' => 'Art',
+//        'breadcrumb'    => 'Art',
+//        'addCrumb'  => 'form',
+//        'hide_single'  => false,
+//        'show_feed'    => true,
+//        'show_directory'=> true,
+//        'favouritable' => true,
+//        'karma'        => false,
+//        'icon'         => 'palette',
+//        'seo' => [
+//            'schema' => [
+//                'type' => 'VisualArtwork',
+//                'name' => '{{post_title}}',
+//                'description' => '{{post_excerpt}}',
+//                'about' => ['@id' => '{{site_url}}/#art'],
+//                'associatedMedia' => '{{post_thumbnail}}',
+//                'dateCreated' => '{{post_date}}',
+//                // artform, artMedium, creator, keywords auto-enriched by VisualArtworkResolver
+//            ],
+//            'meta' => [
+//                'title' => '{{post_title}} — {{form.name}} Art | Handmade. Human.',
+//                'description' => '{{post_excerpt}}',
+//            ],
+//            'archive' => [
+//                'type' => 'CollectionPage',
+//                'name' => 'Canadian Art. Made in Edmonton, Alberta.',
+//                'description' => 'Handmade sculpture, jewelry, and more from Edmonton, Alberta.',
+//            ],
+//        ],
+//        'feed'      => [
+//            'single'    => [
+//                'pre_title' => 'Canadian Art. Made in Edmonton, Alberta.',
+//            ],
+//            'archive'   => [
+//
+//            ],
+//            'config'    => [
+//                'is_gallery'    => false,
+//                'content'       => 'art',
+//                'context'       => 'art',
+//                'id'            => [],
+//                'class'         => [],
+//            ]
+//        ],
+//        'rewrite'      => [
+//            'slug'       => 'art',
+//            'with_front' => false,
+//        ],
+//
+//        'fields'       => [
+//            'post_status'         => [
+//                'type'      => 'radio',
+//                'label'     => 'Status',
+//                'options'   => [
+//                    'publish'   => 'Show',
+//                    'draft'     => 'Hide',
+//                    'trash'     => 'Scrap',
+//                    'delete'    => 'Permanently Delete'
+//                ],
+//                'hidden'    => true,
+//            ],
+//            'post_title'     => [
+//                'type'  => 'text',
+//                'label' => 'Title',
+//            ],
+//            'post_date' => [
+//                'type'  => 'date',
+//                'label' => 'Date',
+//            ],
+//            'city'  => [
+//                'type'  => 'taxonomy',
+//                'taxonomy'  => 'city',
+//                'autocomplete'  => true,
+//                'label' => 'City',
+//            ],
+//            'form'  => [
+//                'type'  => 'taxonomy',
+//                'taxonomy'  => 'form',
+//                'autocomplete'  => true,
+//                'label' => 'Art Form',
+//            ],
+//            'media'  => [
+//                'type'  => 'taxonomy',
+//                'taxonomy'  => 'media',
+//                'autocomplete'  => true,
+//                'label' => 'Media',
+//            ],
+//            'style'  => [
+//                'type'  => 'taxonomy',
+//                'taxonomy'  => 'style',
+//                'autocomplete'  => true,
+//                'label' => 'Style',
+//            ],
+//            'theme'  => [
+//                'type'  => 'taxonomy',
+//                'taxonomy'  => 'theme',
+//                'autocomplete'  => true,
+//                'label' => 'Theme',
+//            ],
+//            'project'  => [
+//                'type'  => 'taxonomy',
+//                'taxonomy'  => 'project',
+//                'autocomplete'  => true,
+//                'label' => 'Project',
+//            ],
+//            'post_thumbnail' => [
+//                'type'  => 'upload',
+//                'label' => 'Image',
+//            ],
+//            'gallery'        => [
+//                'type'  => 'upload',
+//                'multiple'=> true,
+//                'label' => 'Gallery',
+//            ],
+//            'price'          => [
+//                'type'  => 'number',
+//                'label' => 'Price',
+//            ],
+//            'post_excerpt'  => [
+//                'type'  => 'textarea',
+//                'label' => 'Short Blurb',
+//            ],
+//            'post_content'   => [
+//                'type'  => 'textarea',
+//                'quill' => true,
+//                'label' => 'Notes'
+//            ],
+//            'needs' => [
+//                'type'  => 'repeater',
+//                'label' => 'Needs',
+//                'fields'=> [
+//                    'need' => [
+//                        'type' => 'text',
+//                        'label' => 'Need',
+//                        'required' => true
+//                    ],
+//                    'image' => [
+//                        'type'  => 'upload',
+//                        'multiple' => true,
+//                        'label' => 'Example Image'
+//                    ],
+//                    'fulfilled' => [
+//                        'type'  => 'textarea',
+//                        'quill' => true,
+//                        'label' => 'How I fulfilled it'
+//                    ]
+//                ]
+//            ],
+//            'wants' => [
+//                'type'  => 'repeater',
+//                'label' => 'Wants',
+//                'fields'=> [
+//                    'need' => [
+//                        'type' => 'text',
+//                        'label' => 'Want',
+//                        'required' => true
+//                    ],
+//                    'image' => [
+//                        'type'  => 'upload',
+//                        'multiple' => true,
+//                        'label' => 'Example Image'
+//                    ],
+//                    'fulfilled' => [
+//                        'type'  => 'textarea',
+//                        'quill' => true,
+//                        'label' => 'How I fulfilled it'
+//                    ]
+//                ]
+//            ],
+//        ],
+//        'single_image' => false,
+//        'upload_title' => 'Upload Artwork',
+//    ];
+//}
+
+function ajv_prerender_art_content(array $block, ?string $content, ?WP_Block $parent):?string
 {
     $out = '';
     $ID = get_the_ID();
@@ -192,42 +356,53 @@
 
     $fields = $meta->getAll();
 
+
+
     $bits = [];
-    if (array_key_exists('post_excerpt', $fields) && !empty($fields['post_excerpt'])) {
-        $bits[] = sprintf(
-            '<section id="excerpt"><h2>At a Glance</h2>%s</section>',
-            apply_filters('the_content', $fields['post_excerpt'])
+    $excerpt = '';
+
+    $rows = [];
+    foreach (['project', 'form', 'city', 'media', 'style', 'theme'] as $type) {
+
+        if (!empty($fields[$type])) {
+            $rows[] = jvbMetaTermList($fields[$type], $type);
+        }
+
+    }
+    if (!empty($rows)) {
+        $excerpt .= sprintf(
+            '<ul class="summary">%s</ul>',
+            implode('', array_map(function ($row) {
+                return '<li>'.$row.'</li>';
+            }, $rows))
         );
     }
 
-    if (array_key_exists('gallery', $fields) && !empty($fields['gallery'])) {
-        $gallery = explode(',',$fields['gallery']);
-        $gallery = array_map(function ($imgID) {
-            $out = '<figure>'.jvbFormatImage($imgID,'tiny','medium');
-            $caption = wp_get_attachment_caption($imgID);
-            $out .= ($caption && $caption !== '') ? '<figcaption>'.apply_filters('the_content', $caption).'</figcaption>' : '';
-            $out .= '</figure>';
-            return $out;
+    if (!empty($fields['post_excerpt']??'')) {
+        $excerpt .= wpautop($fields['post_excerpt']);
+    }
+    if (!empty($excerpt)) {
+        $bits[] = sprintf('<section id="summary"><h3>At a Glance</h3>%s</section>',$excerpt);
+    }
 
-        }, $gallery);
-        $gallery = implode('',$gallery);
+    if (!empty($fields['gallery']??'')) {
         $bits[] = sprintf(
-            '<section id="gallery"><h2>Gallery</h2><div>%s</div></section>',
-            $gallery
+            '<section id="gallery"><h2>Gallery</h2>%s</section>',
+            Image::gallery($fields['gallery'])
         );
     }
 
-    if (array_key_exists('post_content', $fields) && !empty($fields['post_content'])) {
+    if (!empty($fields['post_content']??'')) {
         $bits[] = sprintf(
             '<section id="content">%s</section>',
-            apply_filters('the_content', $fields['post_content'])
+            $fields['post_content']
         );
     }
 
-    if (array_key_exists('needs', $fields) && !empty($fields['needs'])) {
+    if (!empty($fields['needs']??'')) {
         $bits[] = ajvb_format_needs($fields['needs']);
     }
-    if (array_key_exists('wants', $fields) && !empty($fields['wants'])) {
+    if (!empty($fields['wants']??'')) {
         $bits[] = ajvb_format_wants($fields['wants']);
     }
 
@@ -237,4 +412,42 @@
 
 
     return $out;
+}
+
+
+function ajv_art_schema():array
+{
+    return [
+        'type'              => 'JVBase\managers\SEO\render\Thing\CreativeWork\VisualArtwork\VisualArtwork',
+        'name'              => '{{post_title}} | Canadian Art',
+        'artist'            => '{{post_author}}',
+        'description'       => '{{post_excerpt}}',
+        'thumbnail'         => '{{post_thumbnail}}',
+        'dateCreated'       => '{{post_date}}',
+        'dateModified'      => '{{post_modified}}',
+        'artform'           => '{{form.name}}',
+        'artMedium'         => '{{media.name}}',
+        'keywords'          => '{{style.name}}',
+    ];
+}
+
+function ajv_art_meta():array
+{
+    return[
+        'name' => '{{post_title}} - {{form.name}} | Handmade. Human Art',
+    ];
+}
+
+function ajv_art_archive(array $defaults):array
+{
+    return array_merge($defaults, [
+        'name' => 'Canadian Art. Made in Edmonton, Alberta.',
+        'description' => 'Handmade sculpture, jewellery, and more from Edmonton, Alberta.',
+        'about' => ['id' => get_post_type_archive_link(BASE.'art').'#service'],
+    ]);
+}
+
+function ajv_art_reference_schema(array $defaults):array
+{
+    return $defaults;
 }
\ No newline at end of file

--
Gitblit v1.10.0