| | |
| | | <?php |
| | | use JVBase\utility\Features; |
| | | |
| | | use JVBase\registrar\Registrar; |
| | | use JVBase\base\Site; |
| | | |
| | | //require(JVB_DIR . '/inc/blocks/RegisterBlocks.php'); |
| | | require(JVB_DIR . '/inc/blocks/CustomBlocks.php'); |
| | | |
| | | if (Features::forSite()->has('feed_block')) { |
| | | require(JVB_DIR . '/inc/blocks/FeedBlock.php'); |
| | | new JVBase\blocks\FeedBlock(); |
| | | } |
| | | |
| | | if (Features::forSite()->has('is_restaurant')) { |
| | | require(JVB_DIR . '/inc/blocks/MenuBlock.php'); |
| | | new JVBase\blocks\MenuBlock(); |
| | | } |
| | | add_action('init', 'jvb_conditionally_load_blocks', 1); |
| | | function jvb_conditionally_load_blocks(): void |
| | | { |
| | | if (Site::has('feed_block')) { |
| | | require('FeedBlock.php'); |
| | | new JVBase\blocks\FeedBlock(); |
| | | } |
| | | |
| | | if (Features::forSite()->has('faq') || array_key_exists('faq', JVB_CONTENT)) { |
| | | require(JVB_DIR . '/inc/blocks/FAQBlock.php'); |
| | | new JVBase\blocks\FAQBlock(); |
| | | if (Site::has('is_restaurant')) { |
| | | require('MenuBlock.php'); |
| | | new JVBase\blocks\MenuBlock(); |
| | | } |
| | | |
| | | if (!empty(Registrar::withFeature('is_faq'))) { |
| | | require('FAQBlock.php'); |
| | | new JVBase\blocks\FAQBlock(); |
| | | } |
| | | |
| | | if (!empty(Registrar::withFeature('is_glossary'))) { |
| | | require('GlossaryBlock.php'); |
| | | new JVBase\blocks\GlossaryBlock(); |
| | | } |
| | | |
| | | if (!empty(Registrar::withFeature('is_timeline'))) { |
| | | require('TimelineBlock.php'); |
| | | new JVBase\blocks\TimelineBlock(); |
| | | } |
| | | |
| | | if (Site::hasIntegration('gmb')) { |
| | | require('GMBReviewBlock.php'); |
| | | new JVBase\blocks\GMBReviewBlock(); |
| | | } |
| | | // if (jvbSiteUsesFeedBlock()) { |
| | | // register_block_type( |
| | | // JVB_DIR . '/build/feed', |
| | | // [ |
| | | // 'render_callback' => 'jvbRenderFeedBlock' |
| | | // ] |
| | | // ); |
| | | // } |
| | | // if (!empty(Registrar::withFeature('show_directory'))) { |
| | | // error_log('Registering Directory List Block'); |
| | | // register_block_type( |
| | | // JVB_DIR . '/build/list', |
| | | // [ |
| | | // 'render_callback' => 'jvbRenderListBlock' |
| | | // ] |
| | | // ); |
| | | // } |
| | | |
| | | } |
| | | |
| | | |
| | | if (Features::anyContentHas('is_gallery')) { |
| | | require(JVB_DIR . '/inc/blocks/GlossaryBlock.php'); |
| | | new JVBase\blocks\GlossaryBlock(); |
| | | } |
| | | if (Features::anyContentHas('is_timeline')) { |
| | | require(JVB_DIR . '/inc/blocks/TimelineBlock.php'); |
| | | new JVBase\blocks\TimelineBlock(); |
| | | } |
| | | require(JVB_DIR . '/inc/blocks/SummaryBlock.php'); |
| | | require('SummaryBlock.php'); |
| | | new JVBase\blocks\SummaryBlock(); |
| | | |
| | | require(JVB_DIR . '/inc/blocks/VideoCoverBlock.php'); |
| | | require('VideoCoverBlock.php'); |
| | | new JVBase\blocks\VideoCoverBlock(); |
| | | |
| | | require(JVB_DIR . '/inc/blocks/FormBlock.php'); |
| | | require('FormBlock.php'); |
| | | new JVBase\blocks\FormBlock(); |
| | | |
| | | require ('DrawerMenuBlock.php'); |
| | | new JVBase\blocks\DrawerMenuBlock(); |
| | | |
| | | |
| | | function jvbRegisterBlockCategory(array $categories):array |
| | | { |
| | |
| | | ]); |
| | | } |
| | | add_filter('block_categories_all', 'jvbRegisterBlockCategory'); |
| | | |
| | | if (Features::hasIntegration('gmb')) { |
| | | require(JVB_DIR . '/build/gmbreviews/render.php'); |
| | | } |
| | | function jvbRegisterBlocks():void |
| | | { |
| | | if (Features::hasIntegration('gmb')) { |
| | | register_block_type( |
| | | JVB_DIR . '/build/gmbreviews', |
| | | [ |
| | | 'render_callback' => 'jvbRenderGMBReviewsBlock' |
| | | ]); |
| | | } |
| | | // if (jvbSiteUsesFeedBlock()) { |
| | | // register_block_type( |
| | | // JVB_DIR . '/build/feed', |
| | | // [ |
| | | // 'render_callback' => 'jvbRenderFeedBlock' |
| | | // ] |
| | | // ); |
| | | // } |
| | | if (Features::anyContentHas('show_directory') || Features::anyTaxonomyHas('show_directory')) { |
| | | register_block_type( |
| | | JVB_DIR . '/build/list', |
| | | [ |
| | | 'render_callback' => 'jvbRenderListBlock' |
| | | ] |
| | | ); |
| | | } |
| | | } |
| | | add_action('init', 'jvbRegisterBlocks'); |