Automattic\WooCommerce\Blocks\BlockTypes
SavedForLater::initialize
Initialize this block type.
Method of the class: SavedForLater{}
No Hooks.
Returns
null. Nothing (null).
Usage
// protected - for code of main (parent) or child class $result = $this->initialize(): void;
SavedForLater::initialize() SavedForLater::initialize code WC 11.2.1
protected function initialize(): void {
// The block type is registered unconditionally (see BlockTypesController)
// so content saved while the feature was on doesn't show an "unsupported
// block" notice once it's off. When the feature is disabled we strip the
// hook declaration and hide the block from the inserter, so it neither
// auto-injects nor can be added manually. `block_type_metadata_settings`
// edits the normalized `WP_Block_Type` settings and must be filtered
// before `parent::initialize()` registers the block.
add_filter( 'block_type_metadata_settings', array( $this, 'disable_when_feature_off' ), 10, 2 );
parent::initialize();
// Seeds the default heading on the auto-injected block (only fires while
// the feature is on and the block is being hooked).
add_filter( 'hooked_block_woocommerce/saved-for-later', array( $this, 'set_hooked_block_attributes' ), 10, 4 );
}