run:R W Run
1.49 KB
2026-03-11 16:18:51
R W Run
2.77 KB
2026-03-11 16:18:51
R W Run
2.04 KB
2026-03-11 16:18:51
R W Run
3.07 KB
2026-03-11 16:18:51
R W Run
error_log
📄pattern-overrides.php
1<?php
2/**
3 * Pattern Overrides source for the Block Bindings.
4 *
5 * @since 6.5.0
6 * @package WordPress
7 * @subpackage Block Bindings
8 */
9
10/**
11 * Gets value for the Pattern Overrides source.
12 *
13 * @since 6.5.0
14 * @access private
15 *
16 * @param array $source_args Array containing source arguments used to look up the override value.
17 * Example: array( "key" => "foo" ).
18 * @param WP_Block $block_instance The block instance.
19 * @param string $attribute_name The name of the target attribute.
20 * @return mixed The value computed for the source.
21 */
22function _block_bindings_pattern_overrides_get_value( array $source_args, $block_instance, string $attribute_name ) {
23 if ( empty( $block_instance->attributes['metadata']['name'] ) ) {
24 return null;
25 }
26 $metadata_name = $block_instance->attributes['metadata']['name'];
27 return _wp_array_get( $block_instance->context, array( 'pattern/overrides', $metadata_name, $attribute_name ), null );
28}
29
30/**
31 * Registers Pattern Overrides source in the Block Bindings registry.
32 *
33 * @since 6.5.0
34 * @access private
35 */
36function _register_block_bindings_pattern_overrides_source() {
37 register_block_bindings_source(
38 'core/pattern-overrides',
39 array(
40 'label' => _x( 'Pattern Overrides', 'block bindings source' ),
41 'get_value_callback' => '_block_bindings_pattern_overrides_get_value',
42 'uses_context' => array( 'pattern/overrides' ),
43 )
44 );
45}
46
47add_action( 'init', '_register_block_bindings_pattern_overrides_source' );
48
Ui Ux Design – Teachers Night Out

Get in Touch

© 2024 Teachers Night Out. All Rights Reserved.