wp_has_border_feature_support()
Checks whether the current block type supports the border feature requested.
If the __experimentalBorder support flag is a boolean true all border support features are available. Otherwise, the specific feature's support flag nested under experimentalBorder must be enabled for the feature to be opted into.
Внутренняя функция — эта функция рассчитана на использование самим ядром. Не рекомендуется использовать эту функцию в своем коде.
Хуков нет.
Возвращает
true|false
. Whether the feature is supported.
Использование
wp_has_border_feature_support( $block_type, $feature, $default_value );
- $block_type(WP_Block_Type) (обязательный)
- Block type to check for support.
- $feature(строка) (обязательный)
- Name of the feature to check support for.
- $default_value(разное)
- Fallback value for feature support.
По умолчанию: false
Список изменений
С версии 5.8.0 | Введена. |
Код wp_has_border_feature_support() wp has border feature support WP 6.6.2
function wp_has_border_feature_support( $block_type, $feature, $default_value = false ) { // Check if all border support features have been opted into via `"__experimentalBorder": true`. if ( $block_type instanceof WP_Block_Type ) { $block_type_supports_border = isset( $block_type->supports['__experimentalBorder'] ) ? $block_type->supports['__experimentalBorder'] : $default_value; if ( true === $block_type_supports_border ) { return true; } } // Check if the specific feature has been opted into individually // via nested flag under `__experimentalBorder`. return block_has_support( $block_type, array( '__experimentalBorder', $feature ), $default_value ); }