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



block_has_support › WordPress Function

Seit5.8.0
Veraltetn/v
block_has_support ( $block_type, $feature, $default = false )
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 Fallback value for feature support, defaults to false.
    Erforderlich: Nein
    Standard: false
Gibt zurück:
  • (bool) Whether or not the feature is supported.
Definiert in:
Codex:

Checks whether the current block type supports the feature requested.



Quellcode

function block_has_support( $block_type, $feature, $default = false ) {
	$block_support = $default;
	if ( $block_type && property_exists( $block_type, 'supports' ) ) {
		$block_support = _wp_array_get( $block_type->supports, $feature, $default );
	}

	return true === $block_support || is_array( $block_support );
}