Automattic\WooCommerce\Blocks\BlockTypes

SavedForLater::initialize │ protected │ WC 1.0

Initialize this block type.

Метод класса: SavedForLater{}

Хуков нет.

Возвращает

null. Ничего (null).

Использование

// protected - в коде основоного (родительского) или дочернего класса
$result = $this->initialize(): void;

Код SavedForLater::initialize() 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 );
}