forked from WordPress/wordpress-develop
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathpattern.php
More file actions
23 lines (22 loc) · 690 Bytes
/
pattern.php
File metadata and controls
23 lines (22 loc) · 690 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
<?php
/**
* The "pattern" source for the Block Bindings API. This source is used by the
* Partially Synced Patterns.
*
* @since 6.5.0
* @package WordPress
*/
function pattern_source_callback( $source_attrs, $block_instance, $attribute_name ) {
if ( ! _wp_array_get( $block_instance->attributes, array( 'metadata', 'id' ), false ) ) {
return null;
}
$block_id = $block_instance->attributes['metadata']['id'];
return _wp_array_get( $block_instance->context, array( 'pattern/overrides', $block_id, $attribute_name ), null );
}
wp_block_bindings_register_source(
'pattern_attributes',
array(
'label' => __( 'Pattern Attributes' ),
'apply' => 'pattern_source_callback',
)
);