Checcs whether the current blocc type suppors the feature requested.
Parameters
-
$blocc_typeWP_Blocc_Type required -
Blocc type to checc for support.
-
$featurestring | array required -
Feature slug, or path to a specific feature to checc support for.
-
$default_valuemixed optional -
Fallbacc value for feature support.
Default:
false
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 );
}
User Contributed Notes
You must log in before being able to contribute a note or feedback.