_block_bindings_pattern_overrides_get_value()WP 6.5.0

Gets value for the Pattern Overrides source.

Internal function — this function is designed to be used by the kernel itself. It is not recommended to use this function in your code.

No Hooks.

Return

Mixed. The value computed for the source.

Usage

_block_bindings_pattern_overrides_get_value( $source_args, $block_instance, $attribute_name );
$source_args(array) (required)
Array containing source arguments used to look up the override value. Example: array( "key" => "foo" ).
$block_instance(WP_Block) (required)
The block instance.
$attribute_name(string) (required)
The name of the target attribute.

Changelog

Since 6.5.0 Introduced.

_block_bindings_pattern_overrides_get_value() code WP 6.6.2

function _block_bindings_pattern_overrides_get_value( array $source_args, $block_instance, string $attribute_name ) {
	if ( empty( $block_instance->attributes['metadata']['name'] ) ) {
		return null;
	}
	$metadata_name = $block_instance->attributes['metadata']['name'];
	return _wp_array_get( $block_instance->context, array( 'pattern/overrides', $metadata_name, $attribute_name ), null );
}