| @@ -1,291 +1,324 @@ | ||
| 1 | -<?php | |
| 2 | - | |
| 3 | -namespace Getwid; | |
| 4 | - | |
| 5 | -/** | |
| 6 | - * Class BlocksManager | |
| 7 | - * @package Getwid | |
| 8 | - */ | |
| 9 | -class BlocksManager { | |
| 10 | - | |
| 11 | - private $blocks = array(); | |
| 12 | - private $enabledBlocks = array(); | |
| 13 | - private $disabledBlocks = array(); | |
| 14 | - | |
| 15 | - /** | |
| 16 | - * BlockManager constructor. | |
| 17 | - */ | |
| 18 | - public function __construct() { | |
| 19 | - | |
| 20 | - if ( version_compare( get_bloginfo( 'version' ), '5.8', '>=' ) ) { | |
| 21 | - add_filter( 'block_categories_all', array( $this, 'block_categories_all' ), 10, 2 ); | |
| 22 | - } else { | |
| 23 | - add_filter( 'block_categories', array( $this, 'block_categories' ), 10, 2 ); | |
| 24 | - } | |
| 25 | - | |
| 26 | - add_action( 'init', [$this, 'includeBlocks'] ); | |
| 27 | - } | |
| 28 | - | |
| 29 | - public function block_categories_all( $block_categories, $editor_context ) { | |
| 30 | - | |
| 31 | - //Add Getwid blocks category | |
| 32 | - $block_categories = array_merge( | |
| 33 | - $block_categories, | |
| 34 | - array( | |
| 35 | - array( | |
| 36 | - 'slug' => 'getwid-blocks', | |
| 37 | - 'title' => __( 'Getwid Blocks', 'getwid' ), | |
| 38 | - ), | |
| 39 | - ) | |
| 40 | - ); | |
| 41 | - | |
| 42 | - //Add Getwid post-block category (Only on Templates page) | |
| 43 | - if ( ! empty( $editor_context->post ) && ( $editor_context->post->post_type == getwid()->postTemplatePart()->postType ) ) { | |
| 44 | - $block_categories = array_merge( | |
| 45 | - $block_categories, | |
| 46 | - array( | |
| 47 | - array( | |
| 48 | - 'slug' => 'getwid-post-blocks', | |
| 49 | - 'title' => __( 'Getwid Post Blocks', 'getwid' ), | |
| 50 | - ), | |
| 51 | - ) | |
| 52 | - ); | |
| 53 | - } | |
| 54 | - | |
| 55 | - if ( getwid_acf_is_active() ) { | |
| 56 | - if ( ! empty( $editor_context->post ) && ( $editor_context->post->post_type == getwid()->postTemplatePart()->postType ) ) { | |
| 57 | - $block_categories = array_merge( | |
| 58 | - $block_categories, | |
| 59 | - array( | |
| 60 | - array( | |
| 61 | - 'slug' => 'getwid-acf-blocks', | |
| 62 | - 'title' => __( 'Getwid ACF Blocks', 'getwid' ), | |
| 63 | - ), | |
| 64 | - ) | |
| 65 | - ); | |
| 66 | - } | |
| 67 | - } | |
| 68 | - | |
| 69 | - return $block_categories; | |
| 70 | - } | |
| 71 | - | |
| 72 | - public function block_categories( $categories, $post ) { | |
| 73 | - | |
| 74 | - //Add Getwid blocks category | |
| 75 | - $categories = array_merge( | |
| 76 | - $categories, | |
| 77 | - array( | |
| 78 | - array( | |
| 79 | - 'slug' => 'getwid-blocks', | |
| 80 | - 'title' => __( 'Getwid Blocks', 'getwid' ), | |
| 81 | - ), | |
| 82 | - ) | |
| 83 | - ); | |
| 84 | - | |
| 85 | - //Add Getwid post-block category (Only on Templates page) | |
| 86 | - if ( $post && ( $post->post_type == getwid()->postTemplatePart()->postType ) ) { | |
| 87 | - $categories = array_merge( | |
| 88 | - $categories, | |
| 89 | - array( | |
| 90 | - array( | |
| 91 | - 'slug' => 'getwid-post-blocks', | |
| 92 | - 'title' => __( 'Getwid Post Blocks', 'getwid' ), | |
| 93 | - ), | |
| 94 | - ) | |
| 95 | - ); | |
| 96 | - } | |
| 97 | - | |
| 98 | - if ( getwid_acf_is_active() ) { | |
| 99 | - if ( $post && ( $post->post_type == getwid()->postTemplatePart()->postType ) ) { | |
| 100 | - $categories = array_merge( | |
| 101 | - $categories, | |
| 102 | - array( | |
| 103 | - array( | |
| 104 | - 'slug' => 'getwid-acf-blocks', | |
| 105 | - 'title' => __( 'Getwid ACF Blocks', 'getwid' ), | |
| 106 | - ), | |
| 107 | - ) | |
| 108 | - ); | |
| 109 | - } | |
| 110 | - } | |
| 111 | - | |
| 112 | - return $categories; | |
| 113 | - } | |
| 114 | - | |
| 115 | - public function includeBlocks() { | |
| 116 | - | |
| 117 | - $block_files = array( | |
| 118 | - 'abstract-block', | |
| 119 | - | |
| 120 | - 'ai-text', | |
| 121 | - 'anchor', | |
| 122 | - 'accordion', | |
| 123 | - 'advanced-heading', | |
| 124 | - 'advanced-spacer', | |
| 125 | - 'banner', | |
| 126 | - 'button-group', | |
| 127 | - 'circle-progress-bar', | |
| 128 | - 'counter', | |
| 129 | - 'custom-post-type', | |
| 130 | - 'icon-box', | |
| 131 | - 'icon', | |
| 132 | - 'image-box', | |
| 133 | - 'images-slider', | |
| 134 | - 'images-stack', | |
| 135 | - 'instagram', | |
| 136 | - 'google-map', | |
| 137 | - 'media-text-slider', | |
| 138 | - 'person', | |
| 139 | - 'post-carousel', | |
| 140 | - 'post-slider', | |
| 141 | - 'price-box', | |
| 142 | - 'price-list', | |
| 143 | - 'progress-bar', | |
| 144 | - 'recent-posts', | |
| 145 | - 'section', | |
| 146 | - 'social-links', | |
| 147 | - 'tabs', | |
| 148 | - 'testimonial', | |
| 149 | - 'toggle', | |
| 150 | - 'table-of-contents', | |
| 151 | - 'video-popup', | |
| 152 | - 'image-hotspot', | |
| 153 | - 'countdown', | |
| 154 | - 'template-library', | |
| 155 | - 'contact-form', | |
| 156 | - 'mailchimp', | |
| 157 | - 'content-timeline', | |
| 158 | - 'table', | |
| 159 | - 'content-slider' | |
| 160 | - ); | |
| 161 | - | |
| 162 | - // load and register main blocks | |
| 163 | - foreach ( $block_files as $block_file_name ) { | |
| 164 | - $this->require_block($block_file_name); | |
| 165 | - } | |
| 166 | - | |
| 167 | - // fill array of active blocks | |
| 168 | - foreach ( $this->blocks as $block ) { | |
| 169 | - | |
| 170 | - if ( $block->isEnabled() ) { | |
| 171 | - $this->enabledBlocks[] = $block; | |
| 172 | - } else { | |
| 173 | - $this->disabledBlocks[] = $block; | |
| 174 | - } | |
| 175 | - } | |
| 176 | - | |
| 177 | - $template_parts = array( | |
| 178 | - 'template-parts/post-title', | |
| 179 | - 'template-parts/post-featured-image', | |
| 180 | - 'template-parts/post-content', | |
| 181 | - 'template-parts/post-link', | |
| 182 | - 'template-parts/post-button', | |
| 183 | - 'template-parts/post-author', | |
| 184 | - 'template-parts/post-categories', | |
| 185 | - 'template-parts/post-comments', | |
| 186 | - 'template-parts/post-tags', | |
| 187 | - 'template-parts/post-date', | |
| 188 | - 'template-parts/post-featured-background-image', | |
| 189 | - 'template-parts/post-meta', | |
| 190 | - 'template-parts/post-custom-field', | |
| 191 | - 'template-parts/post-layout-helper', | |
| 192 | - ); | |
| 193 | - | |
| 194 | - // load template-parts blocks | |
| 195 | - foreach ( $template_parts as $block_file_name ) { | |
| 196 | - $this->require_block($block_file_name); | |
| 197 | - } | |
| 198 | - | |
| 199 | - $template_parts_acf = array( | |
| 200 | - 'template-parts/acf/background-image', | |
| 201 | - 'template-parts/acf/image', | |
| 202 | - 'template-parts/acf/select', | |
| 203 | - 'template-parts/acf/wysiwyg', | |
| 204 | - ); | |
| 205 | - | |
| 206 | - // load template-acf blocks | |
| 207 | - foreach ( $template_parts_acf as $block_file_name ) { | |
| 208 | - $this->require_block($block_file_name); | |
| 209 | - } | |
| 210 | - | |
| 211 | - } | |
| 212 | - | |
| 213 | - private function require_block( $block_file_name ) { | |
| 214 | - | |
| 215 | - $path = getwid_get_plugin_path( '/includes/blocks/' . $block_file_name . '.php' ); | |
| 216 | - | |
| 217 | - if ( file_exists( $path ) ) { | |
| 218 | - require_once( $path ); | |
| 219 | - } | |
| 220 | - } | |
| 221 | - | |
| 222 | - public function addBlock( $block ) { | |
| 223 | - | |
| 224 | - if ( $block instanceof \Getwid\Blocks\AbstractBlock ) { | |
| 225 | - $this->blocks[ $block::getBlockName() ] = $block; | |
| 226 | - } | |
| 227 | - } | |
| 228 | - | |
| 229 | - public function getBlocks() { | |
| 230 | - return $this->blocks; | |
| 231 | - } | |
| 232 | - | |
| 233 | - public function getEnabledBlocks() { | |
| 234 | - return $this->enabledBlocks; | |
| 235 | - } | |
| 236 | - | |
| 237 | - public function getDisabledBlocks() { | |
| 238 | - return $this->disabledBlocks; | |
| 239 | - } | |
| 240 | - | |
| 241 | - public function hasEnabledBlocks() { | |
| 242 | - return ( sizeof ($this->enabledBlocks ) > 0 ); | |
| 243 | - } | |
| 244 | - | |
| 245 | - public function hasDisabledBlocks() { | |
| 246 | - return ( sizeof ($this->disabledBlocks ) > 0 ); | |
| 247 | - } | |
| 248 | - | |
| 249 | - /** | |
| 250 | - * Determine whether a post or content string has Getwid blocks. | |
| 251 | - */ | |
| 252 | - public function hasGetwidBlocks() { | |
| 253 | - | |
| 254 | - $has_getwid_blocks = false; | |
| 255 | - | |
| 256 | - if ( has_blocks() ) { | |
| 257 | - | |
| 258 | - $blocks = $this->getBlocks(); | |
| 259 | - foreach ( $blocks as $block ) { | |
| 260 | - | |
| 261 | - if ( has_block( $block->getBlockName() ) ) { | |
| 262 | - $has_getwid_blocks = true; | |
| 263 | - break; | |
| 264 | - } | |
| 265 | - } | |
| 266 | - } | |
| 267 | - | |
| 268 | - return apply_filters( 'getwid/blocks/has_getwid_blocks', $has_getwid_blocks); | |
| 269 | - } | |
| 270 | - | |
| 271 | - public function hasGetwidNestedBlocks() { | |
| 272 | - | |
| 273 | - $has_getwid_nested_blocks = false; | |
| 274 | - | |
| 275 | - $nestedBlocks = [ | |
| 276 | - \Getwid\Blocks\PostCarousel::getBlockName(), | |
| 277 | - \Getwid\Blocks\PostSlider::getBlockName(), | |
| 278 | - \Getwid\Blocks\CustomPostType::getBlockName(), | |
| 279 | - ]; | |
| 280 | - | |
| 281 | - foreach( $nestedBlocks as $block ) { | |
| 282 | - if ( has_block($block) ) { | |
| 283 | - $has_getwid_nested_blocks = true; | |
| 284 | - break; | |
| 285 | - } | |
| 286 | - } | |
| 287 | - | |
| 288 | - return apply_filters( 'getwid/blocks/has_getwid_nested_blocks', $has_getwid_nested_blocks); | |
| 289 | - } | |
| 290 | - | |
| 291 | -} | |
| 1 | +<?php | |
| 2 | + | |
| 3 | +namespace Getwid; | |
| 4 | + | |
| 5 | +/** | |
| 6 | + * Class BlocksManager | |
| 7 | + * @package Getwid | |
| 8 | + */ | |
| 9 | +class BlocksManager { | |
| 10 | + | |
| 11 | + private $blocks = array(); | |
| 12 | + private $enabledBlocks = array(); | |
| 13 | + private $disabledBlocks = array(); | |
| 14 | + | |
| 15 | + /** | |
| 16 | + * BlockManager constructor. | |
| 17 | + */ | |
| 18 | + public function __construct() { | |
| 19 | + | |
| 20 | + if ( version_compare( get_bloginfo( 'version' ), '5.8', '>=' ) ) { | |
| 21 | + add_filter( 'block_categories_all', array( $this, 'block_categories_all' ), 10, 2 ); | |
| 22 | + } else { | |
| 23 | + add_filter( 'block_categories', array( $this, 'block_categories' ), 10, 2 ); | |
| 24 | + } | |
| 25 | + | |
| 26 | + add_action( 'init', array( $this, 'includeBlocks' ) ); | |
| 27 | + | |
| 28 | + add_filter( 'block_type_metadata_settings', array( $this, 'filter_block_type_metadata_settings' ), 10, 2 ); | |
| 29 | + } | |
| 30 | + | |
| 31 | + public function block_categories_all( $block_categories, $editor_context ) { | |
| 32 | + | |
| 33 | + //Add Getwid blocks category | |
| 34 | + $block_categories = array_merge( | |
| 35 | + $block_categories, | |
| 36 | + array( | |
| 37 | + array( | |
| 38 | + 'slug' => 'getwid-blocks', | |
| 39 | + 'title' => __( 'Getwid Blocks', 'getwid' ), | |
| 40 | + ), | |
| 41 | + ) | |
| 42 | + ); | |
| 43 | + | |
| 44 | + //Add Getwid post-block category (Only on Templates page) | |
| 45 | + if ( ! empty( $editor_context->post ) && ( $editor_context->post->post_type == getwid()->postTemplatePart()->postType ) ) { | |
| 46 | + $block_categories = array_merge( | |
| 47 | + $block_categories, | |
| 48 | + array( | |
| 49 | + array( | |
| 50 | + 'slug' => 'getwid-post-blocks', | |
| 51 | + 'title' => __( 'Getwid Post Blocks', 'getwid' ), | |
| 52 | + ), | |
| 53 | + ) | |
| 54 | + ); | |
| 55 | + } | |
| 56 | + | |
| 57 | + if ( getwid_acf_is_active() ) { | |
| 58 | + if ( ! empty( $editor_context->post ) && ( $editor_context->post->post_type == getwid()->postTemplatePart()->postType ) ) { | |
| 59 | + $block_categories = array_merge( | |
| 60 | + $block_categories, | |
| 61 | + array( | |
| 62 | + array( | |
| 63 | + 'slug' => 'getwid-acf-blocks', | |
| 64 | + 'title' => __( 'Getwid ACF Blocks', 'getwid' ), | |
| 65 | + ), | |
| 66 | + ) | |
| 67 | + ); | |
| 68 | + } | |
| 69 | + } | |
| 70 | + | |
| 71 | + return $block_categories; | |
| 72 | + } | |
| 73 | + | |
| 74 | + public function block_categories( $categories, $post ) { | |
| 75 | + | |
| 76 | + //Add Getwid blocks category | |
| 77 | + $categories = array_merge( | |
| 78 | + $categories, | |
| 79 | + array( | |
| 80 | + array( | |
| 81 | + 'slug' => 'getwid-blocks', | |
| 82 | + 'title' => __( 'Getwid Blocks', 'getwid' ), | |
| 83 | + ), | |
| 84 | + ) | |
| 85 | + ); | |
| 86 | + | |
| 87 | + //Add Getwid post-block category (Only on Templates page) | |
| 88 | + if ( $post && ( $post->post_type == getwid()->postTemplatePart()->postType ) ) { | |
| 89 | + $categories = array_merge( | |
| 90 | + $categories, | |
| 91 | + array( | |
| 92 | + array( | |
| 93 | + 'slug' => 'getwid-post-blocks', | |
| 94 | + 'title' => __( 'Getwid Post Blocks', 'getwid' ), | |
| 95 | + ), | |
| 96 | + ) | |
| 97 | + ); | |
| 98 | + } | |
| 99 | + | |
| 100 | + if ( getwid_acf_is_active() ) { | |
| 101 | + if ( $post && ( $post->post_type == getwid()->postTemplatePart()->postType ) ) { | |
| 102 | + $categories = array_merge( | |
| 103 | + $categories, | |
| 104 | + array( | |
| 105 | + array( | |
| 106 | + 'slug' => 'getwid-acf-blocks', | |
| 107 | + 'title' => __( 'Getwid ACF Blocks', 'getwid' ), | |
| 108 | + ), | |
| 109 | + ) | |
| 110 | + ); | |
| 111 | + } | |
| 112 | + } | |
| 113 | + | |
| 114 | + return $categories; | |
| 115 | + } | |
| 116 | + | |
| 117 | + public function includeBlocks() { | |
| 118 | + | |
| 119 | + $block_files = array( | |
| 120 | + 'abstract-block', | |
| 121 | + | |
| 122 | + 'ai-text', | |
| 123 | + 'anchor', | |
| 124 | + 'accordion', | |
| 125 | + 'advanced-heading', | |
| 126 | + 'advanced-spacer', | |
| 127 | + 'banner', | |
| 128 | + 'button-group', | |
| 129 | + 'circle-progress-bar', | |
| 130 | + 'counter', | |
| 131 | + 'custom-post-type', | |
| 132 | + 'icon-box', | |
| 133 | + 'icon', | |
| 134 | + 'image-box', | |
| 135 | + 'images-slider', | |
| 136 | + 'images-stack', | |
| 137 | + 'instagram', | |
| 138 | + 'google-map', | |
| 139 | + 'media-text-slider', | |
| 140 | + 'person', | |
| 141 | + 'post-carousel', | |
| 142 | + 'post-slider', | |
| 143 | + 'price-box', | |
| 144 | + 'price-list', | |
| 145 | + 'progress-bar', | |
| 146 | + 'recent-posts', | |
| 147 | + 'section', | |
| 148 | + 'social-links', | |
| 149 | + 'tabs', | |
| 150 | + 'testimonial', | |
| 151 | + 'toggle', | |
| 152 | + 'table-of-contents', | |
| 153 | + 'video-popup', | |
| 154 | + 'image-hotspot', | |
| 155 | + 'countdown', | |
| 156 | + 'template-library', | |
| 157 | + 'contact-form', | |
| 158 | + 'mailchimp', | |
| 159 | + 'content-timeline', | |
| 160 | + 'table', | |
| 161 | + 'content-slider', | |
| 162 | + ); | |
| 163 | + | |
| 164 | + // load and register main blocks | |
| 165 | + foreach ( $block_files as $block_file_name ) { | |
| 166 | + $this->require_block( $block_file_name ); | |
| 167 | + } | |
| 168 | + | |
| 169 | + $template_parts = array( | |
| 170 | + 'template-parts/post-title', | |
| 171 | + 'template-parts/post-featured-image', | |
| 172 | + 'template-parts/post-content', | |
| 173 | + 'template-parts/post-link', | |
| 174 | + 'template-parts/post-button', | |
| 175 | + 'template-parts/post-author', | |
| 176 | + 'template-parts/post-categories', | |
| 177 | + 'template-parts/post-comments', | |
| 178 | + 'template-parts/post-tags', | |
| 179 | + 'template-parts/post-date', | |
| 180 | + 'template-parts/post-featured-background-image', | |
| 181 | + 'template-parts/post-meta', | |
| 182 | + 'template-parts/post-custom-field', | |
| 183 | + 'template-parts/post-layout-helper', | |
| 184 | + ); | |
| 185 | + | |
| 186 | + // load template-parts blocks | |
| 187 | + foreach ( $template_parts as $block_file_name ) { | |
| 188 | + $this->require_block( $block_file_name ); | |
| 189 | + } | |
| 190 | + | |
| 191 | + $template_parts_acf = array( | |
| 192 | + 'template-parts/acf/background-image', | |
| 193 | + 'template-parts/acf/image', | |
| 194 | + 'template-parts/acf/select', | |
| 195 | + 'template-parts/acf/wysiwyg', | |
| 196 | + ); | |
| 197 | + | |
| 198 | + // load template-acf blocks | |
| 199 | + foreach ( $template_parts_acf as $block_file_name ) { | |
| 200 | + $this->require_block( $block_file_name ); | |
| 201 | + } | |
| 202 | + | |
| 203 | + // fill array of active blocks | |
| 204 | + foreach ( $this->blocks as $block ) { | |
| 205 | + | |
| 206 | + if ( $block->is_enabled() ) { | |
| 207 | + $this->enabledBlocks[] = $block; | |
| 208 | + } else { | |
| 209 | + $this->disabledBlocks[] = $block; | |
| 210 | + } | |
| 211 | + } | |
| 212 | + } | |
| 213 | + | |
| 214 | + private function require_block( $block_file_name ) { | |
| 215 | + | |
| 216 | + $path = getwid_get_plugin_path( '/includes/blocks/' . $block_file_name . '.php' ); | |
| 217 | + | |
| 218 | + if ( file_exists( $path ) ) { | |
| 219 | + require_once $path; | |
| 220 | + } | |
| 221 | + } | |
| 222 | + | |
| 223 | + public function addBlock( $block ) { | |
| 224 | + | |
| 225 | + if ( $block instanceof \Getwid\Blocks\AbstractBlock ) { | |
| 226 | + $this->blocks[ $block->get_block_name() ] = $block; | |
| 227 | + } | |
| 228 | + } | |
| 229 | + | |
| 230 | + public function getBlocks() { | |
| 231 | + return $this->blocks; | |
| 232 | + } | |
| 233 | + | |
| 234 | + public function getControlledBlocks() { | |
| 235 | + return array_filter( | |
| 236 | + $this->getBlocks(), | |
| 237 | + function ( $block ) { | |
| 238 | + return $block->can_be_disabled(); | |
| 239 | + } | |
| 240 | + ); | |
| 241 | + } | |
| 242 | + | |
| 243 | + public function getEnabledBlocks() { | |
| 244 | + return $this->enabledBlocks; | |
| 245 | + } | |
| 246 | + | |
| 247 | + public function getDisabledBlocks() { | |
| 248 | + return $this->disabledBlocks; | |
| 249 | + } | |
| 250 | + | |
| 251 | + public function hasEnabledBlocks() { | |
| 252 | + return ( sizeof( $this->enabledBlocks ) > 0 ); | |
| 253 | + } | |
| 254 | + | |
| 255 | + public function hasDisabledBlocks() { | |
| 256 | + return ( sizeof( $this->disabledBlocks ) > 0 ); | |
| 257 | + } | |
| 258 | + | |
| 259 | + /** | |
| 260 | + * Determine whether a post or content string has Getwid blocks. | |
| 261 | + */ | |
| 262 | + public function hasGetwidBlocks() { | |
| 263 | + | |
| 264 | + $has_getwid_blocks = false; | |
| 265 | + | |
| 266 | + if ( has_blocks() ) { | |
| 267 | + | |
| 268 | + $blocks = $this->getBlocks(); | |
| 269 | + foreach ( $blocks as $block ) { | |
| 270 | + | |
| 271 | + if ( has_block( $block->get_block_name() ) ) { | |
| 272 | + $has_getwid_blocks = true; | |
| 273 | + break; | |
| 274 | + } | |
| 275 | + } | |
| 276 | + } | |
| 277 | + | |
| 278 | + return apply_filters( 'getwid/blocks/has_getwid_blocks', $has_getwid_blocks ); | |
| 279 | + } | |
| 280 | + | |
| 281 | + public function hasGetwidNestedBlocks() { | |
| 282 | + | |
| 283 | + $has_getwid_nested_blocks = false; | |
| 284 | + | |
| 285 | + $nestedBlocks = array( | |
| 286 | + 'getwid/post-carousel', | |
| 287 | + 'getwid/post-slider', | |
| 288 | + 'getwid/custom-post-type', | |
| 289 | + ); | |
| 290 | + | |
| 291 | + foreach ( $nestedBlocks as $block ) { | |
| 292 | + if ( has_block( $block ) ) { | |
| 293 | + $has_getwid_nested_blocks = true; | |
| 294 | + break; | |
| 295 | + } | |
| 296 | + } | |
| 297 | + | |
| 298 | + return apply_filters( 'getwid/blocks/has_getwid_nested_blocks', $has_getwid_nested_blocks ); | |
| 299 | + } | |
| 300 | + | |
| 301 | + public function filter_block_type_metadata_settings( $settings, $metadata ) { | |
| 302 | + | |
| 303 | + $blocks = array( | |
| 304 | + 'getwid/accordion', | |
| 305 | + 'getwid/custom-post-type', | |
| 306 | + 'getwid/icon-box', | |
| 307 | + 'getwid/icon', | |
| 308 | + 'getwid/icon', | |
| 309 | + 'getwid/image-hotspot', | |
| 310 | + 'getwid/post-carousel', | |
| 311 | + 'getwid/post-slider', | |
| 312 | + 'getwid/section', | |
| 313 | + 'getwid/social-links', | |
| 314 | + 'getwid/toggle', | |
| 315 | + 'getwid/video-popup', | |
| 316 | + ); | |
| 317 | + | |
| 318 | + if ( in_array( $metadata['name'], $blocks ) ) { | |
| 319 | + $settings['style_handles'] = getwid()->fontIconsManager()->enqueueFonts( $settings['style_handles'] ); | |
| 320 | + } | |
| 321 | + | |
| 322 | + return $settings; | |
| 323 | + } | |
| 324 | +} | |