block_has_support()
最后更新于:2021-11-25 19:57:31
block_has_support( GC_Block_Type$block_type, string$feature, mixed$default=false)Checks whether the current block type supports the feature requested.
参数
- $block_type
-
(GC_Block_Type) (Required) Block type to check for support.
- $feature
-
(string) (Required) Name of the feature to check support for.
- $default
-
(mixed) (Optional) Fallback value for feature support, defaults to false.
Default value: false
响应
(boolean) Whether or not the feature is supported.
源文件
文件: gc-includes/blocks.php
function block_has_support( $block_type, $feature, $default = false ) {
$block_support = $default;
if ( $block_type && property_exists( $block_type, 'supports' ) ) {
$block_support = _gc_array_get( $block_type->supports, $feature, $default );
}
return true === $block_support || is_array( $block_support );
}