From 46d681c6b825d21b3f698d793c4e630c687d90ad Mon Sep 17 00:00:00 2001
From: Jake Vanderwerf <get@jakevanderwerf.ca>
Date: Thu, 21 May 2026 21:41:53 +0000
Subject: [PATCH] =Major CustomBlocks.php overhaul, expanding block support and customization from the editor. theme.json should now be updated on new themes to set brand colours, etc. Also note: major change to .col vs .row alignment: simplifying it to .top .bottom vs the confusion of the differences for .col/.row .start and .a-start
---
build/summary/render.php | 122 ++++++++++++++++++++--------------------
1 files changed, 60 insertions(+), 62 deletions(-)
diff --git a/build/summary/render.php b/build/summary/render.php
index 92863f5..c2c35fb 100644
--- a/build/summary/render.php
+++ b/build/summary/render.php
@@ -1,4 +1,10 @@
<?php
+
+use JVBase\managers\Cache;
+use JVBase\meta\Meta;
+use JVBase\meta\Render;
+use JVBase\registrar\Registrar;
+
if (!defined('ABSPATH')) {
exit; // Exit if accessed directly
}
@@ -28,20 +34,24 @@
function jvbRenderArtistSummary():string
{
$current = get_queried_object();
- $cache = new JVBase\managers\CacheManager('artists', WEEK_IN_SECONDS);
- $key = 'artist-bio-'.$current->ID;
+ $cache = Cache::for('artistSummary', WEEK_IN_SECONDS);
+ $key = $current->ID;
$cached = $cache->get($key);
- $cached = false;
if ($cached !== false) {
return $cached;
}
ob_start();
- $meta = new JVBase\meta\MetaManager((int)$current->ID, 'post');
+ $meta = Meta::forPost($current->ID);
$artist = jvbContentFromUser((int)$current->post_author);
- $sections = JVB_CONTENT[jvbNoBase($current->post_type)]['sections']??[];
- jvbDump($sections);
+ $registrar = Registrar::getInstance($current->post_type));
+ $sections = [];
+ if ($registrar) {
+ $sections = $registrar->getSections();
+ }
+
+
// $handler = JVB()->getContent(str_replace(BASE,'', $current->post_type));
@@ -49,11 +59,11 @@
<nav id="artist" class="on-this-page index">
<label>Jump to:
<button type="button" aria-label="Show Index" title="Show Index" class="toggle" aria-expanded="false">
- <?= jvbIcon('add')?>
+ <?= jvbIcon('plus-square')?>
</button>
</label>
<ul>
- <li><a href="#top" title="Back to Top"><?=jvbIcon('up')?></a></li>
+ <li><a href="#top" title="Back to Top"><?=jvbIcon('caret-circle-up')?></a></li>
<li><a href="#about">About</a></li>
<li><a href="#styles">Styles</a></li>
<li><a href="#contact">Contact</a></li>
@@ -83,7 +93,7 @@
</li>
</ul>
<?php endif; ?>
- <?php $styles = $meta->getValue('top_styles');
+ <?php $styles = $meta->get('top_styles');
if (!empty($styles)) {
?>
<ul class="term-list style">
@@ -94,8 +104,8 @@
$link = get_term_link((int)$style, BASE.'style');
?>
<li>
- <a href="<?=$link?>" title="Learn more about <?=$term->name?>">
- <?=strtolower($term->name)?>
+ <a href="<?=$link?>" title="Learn more about <?=html_entity_decode($term->name)?>">
+ <?=strtolower(html_entity_decode($term->name))?>
</a>
</li>
<?php
@@ -110,15 +120,15 @@
</header>
<section>
<details class="bio-info">
- <summary class="row btw">
+ <summary class="row x-btw">
<h2>About <?= ($artist['name'] !== '') ? $artist['name'] : strtok($artist['display_name'], ' ')?></h2>
</summary>
<div class="columns stack-small">
<div class="column">
- <?php $meta->render('render', 'image_portrait'); ?>
+ <?= Render::renderFrom($meta, 'image_portrait'); ?>
</div>
<div class="column">
- <?php $meta->render('render', 'short_bio'); ?>
+ <?= Render::renderFrom($meta, 'short_bio'); ?>
</div>
</div>
<div id="styles">
@@ -134,15 +144,15 @@
</div>
<div id="about">
- <?php $meta->render('render', 'bio')?>
+ <?= Render::renderFrom($meta, 'bio')?>
</div>
</details>
</section>
<section id="contact" class="">
<h2>Contact <?=$artist['name']?></h2>
<?php
- echo jvbRenderContactInfo($current->ID, $meta);
- echo jvbRenderLinks($current->ID, $meta);
+ echo jvbRenderContactInfo($current->ID, 'post');
+ echo jvbRenderLinks($current->ID, 'post');
?>
</section>
<?php
@@ -155,66 +165,55 @@
{
$current = get_queried_object();
- $cache = new JVBase\managers\CacheManager('shops', WEEK_IN_SECONDS);
- $key = 'shop-bio-'.$current->term_id;
+ $cache = Cache::for('shop_bio', WEEK_IN_SECONDS)->connect('taxonomy');
+ $key = $current->term_id;
$cached = $cache->get($key);
- $cached = false;
if ($cached !== false) {
return $cached;
}
ob_start();
- $handler = JVB()->getContent('shop');
-
- $meta = new JVBase\meta\MetaManager($current->term_id, 'term');
- $rating = $meta->getValue('average_rating');
- $opened = $meta->getValue('established');
- $about = $meta->getValue('bio');
- $location = $meta->getValue('location');
- $hours = $meta->getValue('hours');
- $specialty = $meta->getValue('specialties');
- $awards = $meta->getValue('awards');
- $reviews = $meta->getValue('reviews');
-
+ $meta = Meta::forTerm($current->term_id);
+ $fields = $meta->getAll(['average_rating', 'established', 'bio','location','hours','specialties','awards','reviews']);
?>
<nav id="shop" class="on-this-page index">
<label>Jump to:
<button type="button" aria-label="Show Index" title="Show Index" class="toggle" aria-expanded="false">
- <?= jvbIcon('add')?>
+ <?= jvbIcon('plus-square')?>
</button>
</label>
<ul>
- <li><a href="#top" title="Back to Top"><?=jvbIcon('up')?></a></li> <?php
- if ($rating !== 'none') {
+ <li><a href="#top" title="Back to Top"><?=jvbIcon('caret-circle-up')?></a></li> <?php
+ if ($fields['rating'] !== 'none') {
?>
<li><a href="#rating">Rating</a></li>
<?php
- } elseif ($opened !== '') {
+ } elseif ($fields['opened'] !== '') {
?>
<li><a href="#opened">Opened</a></li>
<?php
- } elseif ($location !== '') {
+ } elseif ($fields['location'] !== '') {
?>
<li><a href="#location">Location</a></li>
<?php
- } elseif ($about !== '') {
+ } elseif ($fields['about'] !== '') {
?>
<li><a href="#about">About</a></li>
<?php
- } elseif ($hours !== '') {
+ } elseif ($fields['hours'] !== '') {
?>
<li><a href="#hours">Hours</a></li>
<?php
- } elseif ($specialty !== '') {
+ } elseif ($fields['specialties'] !== '') {
?>
<li><a href="#specialties">Specialties</a></li>
<?php
- } elseif ($awards !== '') {
+ } elseif ($fields['awards'] !== '') {
?>
<li><a href="#awards">Awards</a></li>
<?php
- } elseif ($reviews !== '') {
+ } elseif ($fields['reviews'] !== '') {
?>
<li><a href="#reviews">Reviews</a></li>
<?php
@@ -227,58 +226,58 @@
<header id="top">
<div class="columns stack-small">
<div class="column">
- <?=jvbFormatImage($meta->getValue('image'))?>
+ <?=jvbFormatImage($meta->get('image'))?>
</div>
<div class="column">
<h1>
- <small><?= (get_term((int)$meta->getValue('city'), BASE.'city')) ?
- get_term((int)$meta->getValue('city'), BASE.'city')->name :
+ <small><?= (get_term((int)$meta->get('city'), BASE.'city')) ?
+ get_term((int)$meta->get('city'), BASE.'city')->name :
'Edmonton'?>'s Best Tattoo Shops</small>
<?=$current->name?>
</h1>
- <?= jvbFormatRating($current->term_id, $meta) ?>
- <?php $meta->render('render', 'slogan'); ?>
+ <?= jvbFormatRating($current->term_id, 'term') ?>
+ <?= Render::renderFrom($meta, 'slogan'); ?>
</div>
</div>
</header>
<section>
<details class="bio-info">
- <summary class="row btw">
+ <summary class="row x-btw">
<h2>Learn More About <?=$current->name?></h2>
</summary>
<div class="map">
- <?php $meta->render('render', 'location'); ?>
+ <?= Render::renderFrom($meta, 'location'); ?>
</div>
<div class="short-bio">
- <?php $meta->render('render', 'short_bio'); ?>
+ <?= Render::renderFrom($meta, 'short_bio'); ?>
</div>
<div class="contact">
<h3>Contact:</h3>
<?php
- echo jvbRenderContactInfo($current->term_id, $meta);
- echo jvbRenderLinks($current->term_id, $meta);
+ echo jvbRenderContactInfo($current->term_id, 'term');
+ echo jvbRenderLinks($current->term_id, 'term');
?>
</div>
<div id="about">
- <?php $meta->render('render', 'bio')?>
+ <?= Render::renderFrom($meta, 'bio')?>
</div>
</details>
</section>
<section id="contact" class="">
<h2>Contact </h2>
<?php
- echo jvbRenderContactInfo($current->term_id, $meta);
- echo jvbRenderLinks($current->term_id, $meta);
+ echo jvbRenderContactInfo($current->term_id, 'term');
+ echo jvbRenderLinks($current->term_id, 'term');
?>
</section>
- <?= jvbRenderHours($current->term_id, $meta)?>
+ <?= jvbRenderHours($current->term_id, 'term')?>
<?php
$finished = ob_get_clean();
-// $cache->set($key, $finished);
+ $cache->set($key, $finished);
return $finished;
}
@@ -286,10 +285,9 @@
function jvbRenderTermSummary()
{
$current = get_queried_object();
- $cache = new JVBase\managers\CacheManager($current->taxonomy, WEEK_IN_SECONDS);
- $key = $current->taxonomy.'-'.$current->ID;
+ $cache = Cache::for('term_summary', WEEK_IN_SECONDS)->connect('taxonomy');
+ $key = $current->ID;
$cached = $cache->get($key);
- $cached = false;
if ($cached !== false) {
return $cached;
}
@@ -307,8 +305,8 @@
$title = '';
}
- $meta = new JVBase\meta\MetaManager($current->ID, 'term');
- $fields = JVB_TAXONOMY[$tax]['fields']??[];
+ $meta = Meta::forTerm($current->ID);
+ $fields = $meta->getAll();
?>
<header id="top">
--
Gitblit v1.10.0