_block_bindings_pattern_overrides_get_value()
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.
Returns
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() block bindings pattern overrides get value code WP 6.9.1
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 );
}