| @@ -215,8 +215,11 @@ | ||
| 215 | 215 | 'academy_lms' => Helper::is_active_academy(), |
| 216 | 216 | 'storeengine' => Helper::is_active_storeengine(), |
| 217 | 217 | 'wp_map_block' => Helper::is_active_wp_map_block(), |
| 218 | 218 | 'easy_content_manager' => Helper::is_active_easy_content_manager(), |
| 219 | + 'zencommunity' => Helper::is_active_zencommunity(), | |
| 220 | + 'gemboards' => Helper::is_active_gemboards(), | |
| 221 | + 'quizpress' => Helper::is_active_quizpress(), | |
| 219 | 222 | ] |
| 220 | 223 | ); |
| 221 | 224 | return apply_filters( |
| 222 | 225 | 'ablocks/assets/dashboard_scripts_data', |
| @@ -902,17 +905,39 @@ | ||
| 902 | 905 | |
| 903 | 906 | public function set_current_page_template_part( $content, $block ) { |
| 904 | 907 | if ( ! isset( $block['blockName'] ) && is_array( $block ) ) { |
| 905 | 908 | foreach ( $block as $block_item ) { |
| 906 | - if ( ! empty( $block_item['blockName'] ) && strpos( $block_item['blockName'], 'ablocks/' ) !== false ) { | |
| 909 | + if ( $this->is_page_asset_block( $block_item ) ) { | |
| 907 | 910 | $this->current_page_blocks[] = $block_item; |
| 908 | 911 | } |
| 909 | 912 | } |
| 910 | 913 | } |
| 911 | - if ( ! empty( $block['blockName'] ) && strpos( $block['blockName'], 'ablocks/' ) !== false ) { | |
| 914 | + if ( $this->is_page_asset_block( $block ) ) { | |
| 912 | 915 | $this->current_page_blocks[] = $block; |
| 913 | 916 | } |
| 914 | 917 | return $content; |
| 918 | + } | |
| 919 | + | |
| 920 | + /** | |
| 921 | + * Whether a top-level block contributes to the page's generated assets. | |
| 922 | + * | |
| 923 | + * A synced pattern counts too: AssetsGenerator::recursive_block_parser() | |
| 924 | + * already expands its reference. Collecting only `ablocks/*` names left a | |
| 925 | + * page whose content is just a pattern with no combined CSS/JS at all — so a | |
| 926 | + * Loop Filter placed from a pattern rendered unstyled and did nothing when | |
| 927 | + * clicked. | |
| 928 | + * | |
| 929 | + * @param mixed $block Parsed block. | |
| 930 | + * @return bool | |
| 931 | + */ | |
| 932 | + private function is_page_asset_block( $block ) { | |
| 933 | + if ( ! is_array( $block ) || empty( $block['blockName'] ) ) { | |
| 934 | + return false; | |
| 935 | + } | |
| 936 | + if ( 'core/block' === $block['blockName'] ) { | |
| 937 | + return ! empty( $block['attrs']['ref'] ); | |
| 938 | + } | |
| 939 | + return strpos( $block['blockName'], 'ablocks/' ) !== false; | |
| 915 | 940 | } |
| 916 | 941 | |
| 917 | 942 | public function set_theme_builder_locations( $args ) { |
| 918 | 943 | $this->theme_builder_locations = $args; |