From d38d825e3484d822ea3c1f0fb1df37ecf386b18a Mon Sep 17 00:00:00 2001
From: Jake Vanderwerf <get@jakevanderwerf.ca>
Date: Sun, 04 Jan 2026 19:54:16 +0000
Subject: [PATCH] =TaxonomyCreator.js debugging
---
inc/forms/TaxonomySelector.php | 27 +++++++++++++++++++--------
1 files changed, 19 insertions(+), 8 deletions(-)
diff --git a/inc/forms/TaxonomySelector.php b/inc/forms/TaxonomySelector.php
index 6489e0d..ab3d7d5 100644
--- a/inc/forms/TaxonomySelector.php
+++ b/inc/forms/TaxonomySelector.php
@@ -32,6 +32,7 @@
$this->id = sanitize_key($id);
$this->taxonomy = jvbCheckBase($taxonomy);
$this->name = jvbNoBase($taxonomy);
+
$this->title = JVB_TAXONOMY[$this->name]['plural'];
$this->base = $config['base']??'';
@@ -187,13 +188,13 @@
</template>
<template class="termChildrenToggle">
<button type="button" class="toggle-children" aria-expanded="false">
- <?=jvbIcon('add')?>
+ <?=jvbIcon('plus-square')?>
</button>
</template>
<template class="selectedTerm">
<div class="selected-item row">
<span class="item-name"></span>
- <button type="button" class="remove-item row"><?=jvbIcon('close')?></button>
+ <button type="button" class="remove-item row"><?=jvbIcon('x')?></button>
</div>
</template>
<template class="termBreadcrumb">
@@ -211,6 +212,10 @@
* @return string The rendered HTML
*/
public function render(array $selected = [], string $extra = ''): string {
+
+ if (array_key_exists('output', $this->config) && $this->config['output'] === 'minimal') {
+ return $this->renderTaxonomyToggle($selected, $extra);
+ }
// Build data attributes
$dataAttrs = $this->buildDataAttributes($selected);
@@ -237,12 +242,13 @@
<?= $hasAutocomplete ?>
title="Open <?= $this->singular ?> Selector"
aria-label="Select <?= esc_attr($this->plural) ?>">
- <?= jvbIcon('add', ['title' => 'Add ' . $this->title]) ?>
+ <?= jvbIcon('plus-square') ?>
</button>
- <input type="text" id="<?= $this->base ?><?= esc_attr($this->config['name']) ?>-autocomplete" autocomplete="off" data-ignore data-autocomplete>
- <ul class="autocomplete-dropdown" hidden>
-
- </ul>
+ <?php if ($hasAutocomplete !== '') { ?>
+ <input type="text" id="<?= $this->base ?><?= esc_attr($this->config['name']) ?>-autocomplete" autocomplete="off" data-ignore data-autocomplete>
+ <ul class="autocomplete-dropdown" hidden>
+ </ul>
+ <?php } ?>
</div>
<div class="selected-items row" role="region" aria-label="Selected <?= esc_attr($this->plural) ?>">
@@ -259,6 +265,11 @@
return ob_get_clean();
}
+ protected function renderTaxonomyToggle(array $selected = [], string $extra = ''): string
+ {
+ return '<button type="button" data-filter="taxonomy" data-taxonomy="'.$this->name.'" title="Filter by '.$this->singular.'">'.jvbIcon($this->config['icon']).'<span class="label">'.$this->singular.'</span></button>';
+ }
+
/**
* Build data attributes string for the toggle button
*/
@@ -320,7 +331,7 @@
<button type="button"
class="remove-item row"
aria-label="Remove <?= esc_attr($term->name) ?>">
- <?= jvbIcon('close') ?>
+ <?= jvbIcon('x') ?>
</button>
</div>
<?php
--
Gitblit v1.10.0