钩子文档

block_bindings_source_value

💡 云策文档标注

概述

本文档介绍了 block_bindings_source_value 过滤器,用于修改块绑定源计算值的输出。该过滤器在 WP_Block_Bindings_Source::get_value() 方法中被调用,允许开发者自定义源值的处理。

关键要点

  • 过滤器名称:block_bindings_source_value
  • 主要用途:过滤块绑定源的计算值输出
  • 相关函数:WP_Block_Bindings_Source::get_value()
  • 引入版本:WordPress 6.7.0

参数说明

  • $value (mixed):源的计算值
  • $name (string):源名称
  • $source_args (array):包含用于查找覆盖值的源参数的数组,例如 { "key": "foo" }
  • $block_instance (WP_Block):块实例
  • $attribute_name (string):属性名称

📄 原文内容

Filters the output of a block bindings source.

Parameters

$valuemixed
The computed value for the source.
$namestring
The name of the source.
$source_argsarray
Array containing source arguments used to look up the override value, i.e. { “key”: “foo” }.
$block_instanceWP_Block
The block instance.
$attribute_namestring
The name of an attribute.

Source

return apply_filters( 'block_bindings_source_value', $value, $this->name, $source_args, $block_instance, $attribute_name );

Changelog

Version Description
6.7.0 Introduced.