wpseek.com
Eine auf WordPress spezialiserte Suchmaschine für Entwickler und Theme-Autoren



wp_has_border_feature_support › WordPress Function

Seit5.8.0
Veraltetn/v
wp_has_border_feature_support ( $block_type, $feature, $default_value = false )
Zugriff:
  • private
Parameter: (3)
  • (WP_Block_Type) $block_type Block type to check for support.
    Erforderlich: Ja
  • (string) $feature Name of the feature to check support for.
    Erforderlich: Ja
  • (mixed) $default_value Fallback value for feature support, defaults to false.
    Erforderlich: Nein
    Standard: false
Gibt zurück:
  • (bool) Whether the feature is supported.
Definiert in:
Codex:

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.


Quellcode

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 (
		property_exists( $block_type, 'supports' ) &&
		( true === _wp_array_get( $block_type->supports, array( '__experimentalBorder' ), $default_value ) )
	) {
		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 );
}