From d7e7d248cbe41cd7a9ef9c2fb022b6c4831f99a3 Mon Sep 17 00:00:00 2001
From: Jake Vanderwerf <get@jakevanderwerf.ca>
Date: Sun, 31 May 2026 15:22:56 +0000
Subject: [PATCH] =jakevan complete

---
 inc/managers/DirectoryManager.php |   20 ++++++++++----------
 1 files changed, 10 insertions(+), 10 deletions(-)

diff --git a/inc/managers/DirectoryManager.php b/inc/managers/DirectoryManager.php
index 1d5c15a..a72afb8 100644
--- a/inc/managers/DirectoryManager.php
+++ b/inc/managers/DirectoryManager.php
@@ -38,7 +38,7 @@
 
 		jvb_register_do_once('buildDirectories', [$this, 'activate']);
 		add_action('init', [$this, 'registerDirectories']);
-        add_filter('render_block', [$this, 'renderBlock'], 998, 3);
+        add_filter('pre_render_block', [$this, 'renderBlock'], 20, 3);
     }
 
     public function registerDirectories():void
@@ -85,6 +85,7 @@
 	public function getDirectories():array
 	{
 		$directories = get_option(BASE.'directories');
+
 		if (!$directories) {
 			$directories = [];
 			//content
@@ -134,7 +135,7 @@
 			$title = $config['title'];
 			//Bail early if we've already created the page
 			$existing = new WP_Query([
-				'post_type'	=> BASE.'dash',
+				'post_type'	=> BASE.'directory',
 				'name'	=> sanitize_title($title),
 				'posts_per_page'	=> 1,
 			]);
@@ -228,7 +229,6 @@
 //                ];
 //            }
 //        }
-
         if (!empty($created)) {
             update_option(BASE.'directory_ids', $created);
         }
@@ -240,6 +240,7 @@
 	protected function buildDirectoryList():array
 	{
 		$saved = get_option(BASE.'directory_list', []);
+
 		if (empty($saved)) {
 			$all = new WP_Query([
 				'post_type'	=> BASE.'directory',
@@ -373,7 +374,7 @@
 					$config = Registrar::getInstance($slug);
 					$aOpen = '<a href="'.$directory['url'].'" title="See our list of '.$directory['title'].'">';
 					$aClose = '</a>';
-					$cache .= '<li class="directory col start">
+					$cache .= '<li class="directory col left">
 						'. $aOpen.jvbIcon($config->getIcon() !== '' ? $config->getIcon() :'list-dashes').$directory['title'].$aClose;
 					if (!empty($directory['description'])) {
 						$cache .= '<div class="description">';
@@ -412,7 +413,7 @@
 		);
         if ($current !== '' && array_key_exists($current, $this->directories())) {
             $open = ($open) ? ' open' : '';
-            $cache = '<details'.$open.'><summary class="row btw">Other '.$this->referAs(true).':</summary>'.
+            $cache = '<details'.$open.'><summary class="row x-btw">Other '.$this->referAs(true).':</summary>'.
                      str_replace('id="'.$current.'"', 'id="'.$current.'" class="current"', $cache)
                      .'</details>';
         }
@@ -613,7 +614,7 @@
 			$children =$this->renderListChunk($taxonomy, $term->term_id);
 			$out .= '<li>';
 			if ($children !== '') {
-				$out .= '<details class="term"><summary class="row btw"><a href="'.get_term_link($term->term_id, $term->taxonomy).'" title="See more '.html_entity_decode($term->name).'">'.$term->name.'</a></summary>';
+				$out .= '<details class="term"><summary class="row x-btw"><a href="'.get_term_link($term->term_id, $term->taxonomy).'" title="See more '.html_entity_decode($term->name).'">'.$term->name.'</a></summary>';
 				$out .= $children;
 				$out .= '</details>';
 			} else {
@@ -668,7 +669,7 @@
 
         $out = '<ul class="list-none">';
         foreach ($list as $letter => $items) {
-            $out .= '<li id="starts-with-'.$letter.'" class="row a-start btw nowrap"><h3>'.strtoupper($letter).'</h3><ul>';
+            $out .= '<li id="starts-with-'.$letter.'" class="row top x-btw nowrap"><h3>'.strtoupper($letter).'</h3><ul>';
             foreach ($items as $item) {
                 $extra = '';
                 if (!empty($item['extra'])) {
@@ -683,7 +684,7 @@
 				$item_html = apply_filters('jvb_directory_render_item', '', $item, $type, $extra);
 
 				if (empty($item_html)) {
-					$item_html = '<li class="row btw">
+					$item_html = '<li class="row x-btw">
                     <a href="'.$item['url'].'" title="More about '.$item['name'].'">
                         '.$item['name'].'</a>'.$extra.'
                 </li>';
@@ -697,7 +698,7 @@
         return $out;
     }
 
-    public function renderBlock(string $content, array $block, WP_Block $instance)
+    public function renderBlock(?string $content, array $block, ?WP_Block $instance)
     {
         if (!is_post_type_archive(BASE.'directory') && !is_singular(BASE.'directory')) {
             return $content;
@@ -706,7 +707,6 @@
             return $content;
         }
 
-		error_log('Still working on directory manager...');
         // For archive page
         if (is_post_type_archive(BASE.'directory') && $block['blockName'] === 'core/group') {
             return ($block['attrs']['tagName']??'' === 'main') ? '<main>'.$this->renderArchive().'</main>' : $content;

--
Gitblit v1.10.0