File tree Expand file tree Collapse file tree 2 files changed +12
-10
lines changed
Expand file tree Collapse file tree 2 files changed +12
-10
lines changed Original file line number Diff line number Diff line change @@ -12,10 +12,14 @@ import './disabled-blocks'
1212/**
1313 * External dependencies
1414 */
15- import { i18n } from 'stackable'
15+ import {
16+ i18n ,
17+ settings as stackableSettings ,
18+ } from 'stackable'
1619import {
1720 addStackableBlockCategory ,
1821 registerBlockType ,
22+ BLOCK_STATE ,
1923} from '~stackable/util'
2024import { withVisualGuideContext } from '~stackable/higher-order'
2125
@@ -50,7 +54,13 @@ const importAllAndRegister = r => {
5054
5155 // Register the block if it's not already registered and not disabled.
5256 if ( ! getBlockType ( name ) ) {
53- registerBlockType ( name , settings )
57+ // Register the block if the block is not disabled.
58+ if ( ! ( ( settings [ 'stk-block-dependency' ] in stackableSettings . stackable_block_states &&
59+ stackableSettings . stackable_block_states [ settings [ 'stk-block-dependency' ] ] === BLOCK_STATE . DISABLED ) ||
60+ stackableSettings . stackable_block_states [ name ] === BLOCK_STATE . DISABLED
61+ ) ) {
62+ registerBlockType ( name , settings )
63+ }
5464 }
5565 } )
5666}
Original file line number Diff line number Diff line change @@ -489,14 +489,6 @@ export const addStackableBlockCategory = () => {
489489 * @param {Object } _settings The block properties to register
490490 */
491491export const registerBlockType = ( name , _settings ) => {
492- // Do not register the block if the block is disabled.
493- if ( ( _settings [ 'stk-block-dependency' ] in stackableSettings . stackable_block_states &&
494- stackableSettings . stackable_block_states [ _settings [ 'stk-block-dependency' ] ] === BLOCK_STATE . DISABLED ) ||
495- stackableSettings . stackable_block_states [ name ] === BLOCK_STATE . DISABLED
496- ) {
497- return
498- }
499-
500492 let settings = applyFilters ( `stackable.block.metadata` , _settings || { } )
501493
502494 // If there is no variation title, then some labels in the editor will show
You can’t perform that action at this time.
0 commit comments