- Timestamp:
- 09/03/2024 04:31:44 PM (7 months ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/wp-includes/class-wp-block-bindings-source.php
r58075 r58972 2 2 /** 3 3 * Block Bindings API: WP_Block_Bindings_Source class. 4 *5 4 * 6 5 * @package WordPress … … 61 60 * @since 6.5.0 62 61 * 63 * @param string $name 64 * @param array $source_properties 62 * @param string $name The name of the source. 63 * @param array $source_properties The properties of the source. 65 64 */ 66 65 public function __construct( string $name, array $source_properties ) { … … 72 71 73 72 /** 74 * Retrieves the value from the source. 73 * Calls the callback function specified in the `$get_value_callback` property 74 * with the given arguments and returns the result. It can be modified with 75 * `block_bindings_source_value` filter. 75 76 * 76 77 * @since 6.5.0 78 * @since 6.7.0 `block_bindings_source_value` filter was added. 77 79 * 78 * @param array $source_args Array containing source arguments used to look up the override value, i.e. {"key": "foo"}. 79 * @param WP_Block $block_instance The block instance. 80 * @param string $attribute_name The name of the target attribute. 81 * 80 * @param array $source_args Array containing source arguments used to look up the override value, i.e. {"key": "foo"}. 81 * @param WP_Block $block_instance The block instance. 82 * @param string $attribute_name The name of the target attribute. 82 83 * @return mixed The value of the source. 83 84 */ 84 85 public function get_value( array $source_args, $block_instance, string $attribute_name ) { 85 return call_user_func_array( $this->get_value_callback, array( $source_args, $block_instance, $attribute_name ) ); 86 $value = call_user_func_array( $this->get_value_callback, array( $source_args, $block_instance, $attribute_name ) ); 87 /** 88 * Filters the output of a block bindings source. 89 * 90 * @since 6.7.0 91 * 92 * @param mixed $value The computed value for the source. 93 * @param string $name The name of the source. 94 * @param array $source_args Array containing source arguments used to look up the override value, i.e. { "key": "foo" }. 95 * @param WP_Block $block_instance The block instance. 96 * @param string $attribute_name The name of an attribute. 97 */ 98 return apply_filters( 'block_bindings_source_value', $value, $this->name, $source_args, $block_instance, $attribute_name ); 86 99 } 87 100
Note: See TracChangeset
for help on using the changeset viewer.