Automattic\WooCommerce\Admin\Features\ProductBlockEditor

BlockRegistry::has_role_supportprivateWC 1.0

Checks for block attribute role support.

Method of the class: BlockRegistry{}

No Hooks.

Returns

null. Nothing (null).

Usage

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

BlockRegistry::has_role_support() code WC 9.9.5

private function has_role_support() {
	if ( Utils::wp_version_compare( '6.7', '>=' ) ) {
		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, '19.4', '>=' );
	}

	return false;
}