芝麻web文件管理V1.00
编辑当前文件:/home2/sdektunc/cepali.edu.mx/wp-includes/blocks/post-content/block-bindings.php
__( 'My Custom Source', 'my-plugin' ), * 'get_value_callback' => 'my_plugin_get_custom_source_value', * ) ); * } * add_action( 'init', 'my_plugin_register_block_bindings_sources' ); * * ### Usage in a block * * In a block's `metadata.bindings` attribute, you can specify the source and * its arguments. Such a block will use the source to override the block * attribute's value. For example: * * *
Fallback text that gets replaced.
* * * @since 6.5.0 * * @param string $source_name The name of the source. It must be a string containing a namespace prefix, i.e. * `my-plugin/my-custom-source`. It must only contain lowercase alphanumeric * characters, the forward slash `/` and dashes. * @param array $source_properties { * The array of arguments that are used to register a source. * * @type string $label The label of the source. * @type callback $get_value_callback A callback executed when the source is processed during block rendering. * The callback should have the following signature: * * `function ($source_args, $block_instance,$attribute_name): mixed` * - @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 . * The callback has a mixed return type; it may return a string to override * the block's original value, null, false to remove an attribute, etc