WP_Block_Bindings_Source::get_value( array $source_args, WP_Block $block_instance, string $attribute_name ): mixed

In this article

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 filter.

Parameters

$source_argsarrayrequired
Array containing source arguments used to look up the override value, i.e. {"key": "foo"}.
$block_instanceWP_Blockrequired
The block instance.
$attribute_namestringrequired
The name of the target attribute.

Return

mixed The value of the source.

Source

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 );
}

Hooks

apply_filters( ‘block_bindings_source_value’, mixed $value, string $name, array $source_args, WP_Block $block_instance, string $attribute_name )

Filters the output of a block bindings source.

Changelog

VersionDescription
6.7.0block_bindings_source_value filter was added.
6.5.0Introduced.

User Contributed Notes

You must log in before being able to contribute a note or feedback.