Automattic\WooCommerce\Blocks\BlockTypes

ProductQuery::check_if_post_template_has_support_for_grid_view()privateWC 1.0

Post Template support for grid view was introduced in Gutenberg 16 / WordPress 6.3 Fixed in:

Method of the class: ProductQuery{}

No Hooks.

Returns

null. Nothing (null).

Usage

// private - for code of main (parent) class only
$result = $this->check_if_post_template_has_support_for_grid_view();

ProductQuery::check_if_post_template_has_support_for_grid_view() code WC 9.8.5

private function check_if_post_template_has_support_for_grid_view() {
	if ( Utils::wp_version_compare( '6.3', '>=' ) ) {
		return true;
	}

	if ( is_plugin_active( 'gutenberg/gutenberg.php' ) ) {
		$gutenberg_version = '';

		if ( defined( 'GUTENBERG_VERSION' ) ) {
			$gutenberg_version = GUTENBERG_VERSION;
		}

		if ( ! $gutenberg_version ) {
			$gutenberg_data    = get_file_data(
				WP_PLUGIN_DIR . '/gutenberg/gutenberg.php',
				array( 'Version' => 'Version' )
			);
			$gutenberg_version = $gutenberg_data['Version'];
		}
		return version_compare( $gutenberg_version, '16.0', '>=' );
	}

	return false;
}