wpseek.com
Un motore di ricerca WordPress per sviluppatori e autori di temi
block_has_support › WordPress Function
Da5.8.0
Deprecaton/a
› block_has_support ( $block_type, $feature, $default_value = false )
| Parametri: (3) |
|
| Ritorna: |
|
| Definito a: |
|
| Codex: | |
| ChangeLog: |
|
Checks whether the current block type supports the feature requested.
Funzioni correlate: wp_render_block_states_support, wp_http_supports, get_theme_support, remove_theme_support, wp_cache_supports
Sorgenti
function block_has_support( $block_type, $feature, $default_value = false ) {
$block_support = $default_value;
if ( $block_type instanceof WP_Block_Type ) {
if ( is_array( $feature ) && count( $feature ) === 1 ) {
$feature = $feature[0];
}
if ( is_array( $feature ) ) {
$block_support = _wp_array_get( $block_type->supports, $feature, $default_value );
} elseif ( isset( $block_type->supports[ $feature ] ) ) {
$block_support = $block_type->supports[ $feature ];
}
}
return true === $block_support || is_array( $block_support );
}