| | |
| | | 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']); |
| | | } |
| | |
| | | } |
| | | $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>'; |