Docs: Improve documentation for WP_Block_Type properties.

Add a reference to `WP_Block_Type::__construct()` for information on accepted arguments in `register_block_type()`.

Synchronize the documentation between several places, use `WP_Block_Type::__construct()` as the canonical source.

Props ediamin, audrasjb, peterwilsoncc.
Fixes #48640.

git-svn-id: https://develop.svn.wordpress.org/trunk@50419 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
Sergey Biryukov
2021-02-23 19:16:26 +00:00
parent 666bdbb011
commit 0a2ba7cb29
3 changed files with 62 additions and 24 deletions

View File

@@ -15,13 +15,9 @@
* @param string|WP_Block_Type $name Block type name including namespace, or alternatively
* a complete WP_Block_Type instance. In case a WP_Block_Type
* is provided, the $args parameter will be ignored.
* @param array $args {
* Optional. Array of block type arguments. Accepts any public property of `WP_Block_Type`.
* Any arguments may be defined, however the ones described below are supported by default.
* Default empty array.
*
* @type callable $render_callback Callback used to render blocks of this block type.
* }
* @param array $args Optional. Array of block type arguments. Accepts any public property
* of `WP_Block_Type`. See WP_Block_Type::__construct() for information
* on accepted arguments. Default empty array.
* @return WP_Block_Type|false The registered block type on success, or false on failure.
*/
function register_block_type( $name, $args = array() ) {
@@ -190,13 +186,9 @@ function register_block_style_handle( $metadata, $field_name ) {
*
* @param string $file_or_folder Path to the JSON file with metadata definition for
* the block or path to the folder where the `block.json` file is located.
* @param array $args {
* Optional. Array of block type arguments. Accepts any public property of `WP_Block_Type`.
* Any arguments may be defined, however the ones described below are supported by default.
* Default empty array.
*
* @type callable $render_callback Callback used to render blocks of this block type.
* }
* @param array $args Optional. Array of block type arguments. Accepts any public property
* of `WP_Block_Type`. See WP_Block_Type::__construct() for information
* on accepted arguments. Default empty array.
* @return WP_Block_Type|false The registered block type on success, or false on failure.
*/
function register_block_type_from_metadata( $file_or_folder, $args = array() ) {