Jake Vanderwerf
2026-01-01 de699440ff94e9c0d8e8b5201ee93179c085bf60
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']??'';
@@ -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('plus-square', ['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
    */