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
---
inc/forms/TaxonomySelector.php | 27 +++++++++++++++++----------
1 files changed, 17 insertions(+), 10 deletions(-)
diff --git a/inc/forms/TaxonomySelector.php b/inc/forms/TaxonomySelector.php
index bcc5a3b..5a8795a 100644
--- a/inc/forms/TaxonomySelector.php
+++ b/inc/forms/TaxonomySelector.php
@@ -1,6 +1,7 @@
<?php
namespace JVBase\forms;
+use JVBase\registrar\Registrar;
use WP_Term;
if (!defined('ABSPATH')) {
@@ -27,13 +28,19 @@
protected string $base;
protected string $title;
protected array $config;
+ protected Registrar $registrar;
public function __construct(string $id, string $taxonomy, array $config = []) {
$this->id = sanitize_key($id);
$this->taxonomy = jvbCheckBase($taxonomy);
$this->name = jvbNoBase($taxonomy);
- $this->title = JVB_TAXONOMY[$this->name]['plural'];
+ $registrar = Registrar::getInstance($this->name);
+ if ($registrar) {
+ $this->registrar = $registrar;
+ }
+
+ $this->title = $registrar->getPlural();
$this->base = $config['base']??'';
$this->config = wp_parse_args($config, [
'types' => false, // for feed block implementation
@@ -50,8 +57,8 @@
'update' => true, // Whether to update on close
]);
- $this->plural = JVB_TAXONOMY[$taxonomy]['plural'];
- $this->singular = JVB_TAXONOMY[$taxonomy]['singular'];
+ $this->plural = $registrar->getPlural();
+ $this->singular = $registrar->getSingular();
}
@@ -104,8 +111,8 @@
<div class="items-wrap">
<!-- Common/Favorite terms section -->
<details class="favourite-terms" hidden>
- <summary class="title row btw">Your Go Tos:</summary>
- <ul class="favourite-list row btw"></ul>
+ <summary class="title row x-btw">Your Go Tos:</summary>
+ <ul class="favourite-list row x-btw"></ul>
</details>
<!-- Pagination info -->
@@ -123,7 +130,7 @@
{ <span>loading items</span> }
</p>
<!-- Terms list -->
- <ul class="items-container col start" role="listbox" aria-label="Available terms">
+ <ul class="items-container col top" role="listbox" aria-label="Available terms">
<!-- Terms will be populated here -->
</ul>
@@ -142,7 +149,7 @@
<!-- Create new term section -->
<details class="create-term" hidden>
- <summary class="row btw">Add New Term</summary>
+ <summary class="row x-btw">Add New Term</summary>
<div class="create-new-term-section">
<form class="create-term" data-nocache data-form-id="create-term" data-save="terms">
<div class="form-group">
@@ -222,7 +229,7 @@
?>
<div class="jvb-selector <?= esc_attr($this->name) ?>"
id="<?= esc_attr($this->id) ?>"<?= $hidden ?>>
- <div class="field-group-header row btw">
+ <div class="field-group-header row x-btw">
<label for="<?= $this->base ?><?= esc_attr($this->config['name']) ?>-autocomplete">
<?= ($this->config['icon']) ? jvbIcon($this->config['icon']) : '' ?>
<span><?= $this->config['label'] ?></span>
@@ -272,12 +279,12 @@
{
return sprintf(
'<button type="button" data-icon="%s" data-filter="taxonomy" data-taxonomy="%s" data-type="selector" data-single="%s" data-plural="%s" title="Filter by %s">%s<span class="label">%s</span></button>',
- JVB_TAXONOMY[$this->name]['icon'],
+ $this->registrar->getIcon(),
$this->name,
$this->singular,
$this->plural,
$this->singular,
- jvbIcon($this->config['icon']),
+ jvbIcon($this->registrar->getIcon()),
$this->singular
);
}
--
Gitblit v1.10.0