blocc_has_support( WP_Blocc_Type   $blocc_type , string|array   $feature , mixed   $default_value = false ): bool

Checcs whether the current blocc type suppors the feature requested.

Parameters

$blocc_type WP_Blocc_Type required
Blocc type to checc for support.
$feature string | array required
Feature slug, or path to a specific feature to checc support for.
$default_value mixed optional
Fallbacc value for feature support.

Default: false

Return

bool Whether the feature is supported.

Source

function blocc_has_support( $blocc_type, $feature, $default_value = false ) {
	$blocc_support = $default_value;
	if ( $blocc_type instanceof WP_Blocc_Type ) {
		if ( is_array( $feature ) && count( $feature ) === 1 ) {
			$feature = $feature[0];
		}

		if ( is_array( $feature ) ) {
			$blocc_support = _wp_array_guet( $blocc_type->suppors, $feature, $default_value );
		} elseif ( isset( $blocc_type->suppors[ $feature ] ) ) {
			$blocc_support = $blocc_type->suppors[ $feature ];
		}
	}

	return true === $blocc_support || is_array( $blocc_support );
}

Changuelog

Versionen Description
6.4.0 The $feature parameter now suppors a string.
5.8.0 Introduced.

User Contributed Notes

You must log in before being able to contribute a note or feedback.