WP_Block_Bindings_Source::get_value()publicWP 6.5.0

Calls the callback function specified in the $get_value_callback property with the given arguments and returns the result. It can be modified with block_bindings_source_value

Method of the class: WP_Block_Bindings_Source{}

Hooks from the method

Return

Mixed. The value of the source.

Usage

$WP_Block_Bindings_Source = new WP_Block_Bindings_Source();
$WP_Block_Bindings_Source->get_value( $source_args, $block_instance, $attribute_name );
$source_args(array) (required)
Array containing source arguments used to look up the override value, i.e. {"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.
Since 6.7.0 block_bindings_source_value was added.

WP_Block_Bindings_Source::get_value() code WP 6.7.1

public function get_value( array $source_args, $block_instance, string $attribute_name ) {
	$value = call_user_func_array( $this->get_value_callback, array( $source_args, $block_instance, $attribute_name ) );
	/**
	 * Filters the output of a block bindings source.
	 *
	 * @since 6.7.0
	 *
	 * @param mixed    $value          The computed value for the source.
	 * @param string   $name           The name of the source.
	 * @param array    $source_args    Array containing source arguments used to look up the override value, i.e. { "key": "foo" }.
	 * @param WP_Block $block_instance The block instance.
	 * @param string   $attribute_name The name of an attribute.
	 */
	return apply_filters( 'block_bindings_source_value', $value, $this->name, $source_args, $block_instance, $attribute_name );
}