Automattic\WooCommerce\Blocks

BlockTemplatesController::check_should_use_blockified_product_grid_templates()publicWC 1.0

Checks the old and current themes and determines if the "wc_blocks_use_blockified_product_grid_block_as_template" option need to be updated accordingly.

{} Это метод класса: BlockTemplatesController{}

Хуков нет.

Возвращает

null. Ничего.

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

$BlockTemplatesController = new BlockTemplatesController();
$BlockTemplatesController->check_should_use_blockified_product_grid_templates( $old_name, $old_theme );
$old_name(строка) (обязательный)
Old theme name.
$old_theme(\WP_Theme) (обязательный)
Instance of the old theme.

Код BlockTemplatesController::check_should_use_blockified_product_grid_templates() WC 6.9.4

public function check_should_use_blockified_product_grid_templates( $old_name, $old_theme ) {
	if ( ! wc_current_theme_is_fse_theme() ) {
		update_option( Options::WC_BLOCK_USE_BLOCKIFIED_PRODUCT_GRID_BLOCK_AS_TEMPLATE, wc_bool_to_string( false ) );
		return;
	}

	if ( ! $old_theme->is_block_theme() && wc_current_theme_is_fse_theme() ) {
		update_option( Options::WC_BLOCK_USE_BLOCKIFIED_PRODUCT_GRID_BLOCK_AS_TEMPLATE, wc_bool_to_string( true ) );
		return;
	}
}