Jake Vanderwerf
2026-09-13 1aa7c404dae63c9518468fe9b579fad819f8d871
inc/blocks/FAQBlock.php
@@ -1,20 +1,22 @@
<?php
namespace JVBase\blocks;
use JVBase\managers\Cache;
use JVBase\managers\DirectoryManager;
use JVBase\registrar\Registrar;
use WP_Block;
use WP_Query;
if (!defined('ABSPATH')) {
   exit;
}
class FAQBlock {
   protected Cache $cache;
// protected Cache $cache;
   protected string $postType;
   protected string $section;
   protected string $slug;
   protected bool $isDirectory;
   public function __construct()
   {
      $this->cache = Cache::for('faq_block', WEEK_IN_SECONDS)->connect('post', true)->connect('taxonomy', true);
//    $this->cache = Cache::for('faq_block', 'post', WEEK_IN_SECONDS);
      add_action('init', [ $this, 'registerBlock' ]);
      add_action('enqueue_block_editor_assets', [$this, 'localizeData']);
   }
@@ -22,7 +24,8 @@
   /**
    * Register the FAQ block
    */
   public function registerBlock() {
   public function registerBlock():void
   {
      // Register the block
      register_block_type(
         JVB_DIR . '/build/faq',
@@ -123,7 +126,7 @@
    * @param WP_Block $block Block instance
    * @return string Rendered block HTML
    */
   public function render($attributes, $content, $block)
   public function render(array $attributes, string $content, WP_Block $block):string
   {
      ob_start();
      ?>
@@ -261,7 +264,7 @@
         }
         $buttons = '';
         if ($this->isDirectory) {
            $directory = JVB()->directories()->directories($this->slug);
            $directory = DirectoryManager::getInstance()->directories($this->slug);
            $url = $directory['url']??'';
            if (!empty($url)) {
               $buttons .= '<li><a href="'.$url.'">'.__('See Alphabetical List', 'jvb').'</a></li>';