Make WordPress Core

Changeset 50419

Timestamp:
02/23/2021 07:16:26 PM (3 years ago)
Author:
SergeyBiryukov
Message:

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.

Location:
trunk/src/wp-includes
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/wp-includes/blocks.php

    r49982 r50419  
    1616 *                                   a complete WP_Block_Type instance. In case a WP_Block_Type
    1717 *                                   is provided, the $args parameter will be ignored.
    18  * @param array                $args {
    19  *     Optional. Array of block type arguments. Accepts any public property of `WP_Block_Type`.
    20  *     Any arguments may be defined, however the ones described below are supported by default.
    21  *     Default empty array.
    22  *
    23  *     @type callable $render_callback Callback used to render blocks of this block type.
    24  * }
     18 * @param array                $args Optional. Array of block type arguments. Accepts any public property
     19 *                                   of `WP_Block_Type`. See WP_Block_Type::__construct() for information
     20 *                                   on accepted arguments. Default empty array.
    2521 * @return WP_Block_Type|false The registered block type on success, or false on failure.
    2622 */
     
    191187 * @param string $file_or_folder Path to the JSON file with metadata definition for
    192188 *                               the block or path to the folder where the `block.json` file is located.
    193  * @param array  $args {
    194  *     Optional. Array of block type arguments. Accepts any public property of `WP_Block_Type`.
    195  *     Any arguments may be defined, however the ones described below are supported by default.
    196  *     Default empty array.
    197  *
    198  *     @type callable $render_callback Callback used to render blocks of this block type.
    199  * }
     189 * @param array  $args           Optional. Array of block type arguments. Accepts any public property
     190 *                               of `WP_Block_Type`. See WP_Block_Type::__construct() for information
     191 *                               on accepted arguments. Default empty array.
    200192 * @return WP_Block_Type|false The registered block type on success, or false on failure.
    201193 */
  • trunk/src/wp-includes/class-wp-block-type-registry.php

    r48629 r50419  
    3535     * @since 5.0.0
    3636     *
     37
     38
    3739     * @param string|WP_Block_Type $name Block type name including namespace, or alternatively
    3840     *                                   a complete WP_Block_Type instance. In case a WP_Block_Type
    3941     *                                   is provided, the $args parameter will be ignored.
    40      * @param array                $args {
    41      *     Optional. Array of block type arguments. Accepts any public property of `WP_Block_Type`.
    42      *     Any arguments may be defined, however the ones described below are supported by default.
    43      *     Default empty array.
    44      *
    45      *     @type callable $render_callback Callback used to render blocks of this block type.
    46      *     @type array    $attributes      Block attributes mapping, property name to schema.
    47      * }
     42     * @param array                $args Optional. Array of block type arguments. Accepts any public property
     43     *                                   of `WP_Block_Type`. See WP_Block_Type::__construct() for information
     44     *                                   on accepted arguments. Default empty array.
    4845     * @return WP_Block_Type|false The registered block type on success, or false on failure.
    4946     */
  • trunk/src/wp-includes/class-wp-block-type.php

    r49224 r50419  
    3434
    3535    /**
     36
     37
    3638     * @since 5.5.0
    3739     * @var string
     
    4042
    4143    /**
     44
     45
     46
    4247     * @since 5.5.0
    4348     * @var string|null
     
    4651
    4752    /**
     53
     54
     55
    4856     * @since 5.5.0
    4957     * @var array|null
     
    5260
    5361    /**
     62
     63
    5464     * @since 5.5.0
    5565     * @var string|null
     
    5868
    5969    /**
     70
     71
    6072     * @since 5.5.0
    6173     * @var string
     
    6476
    6577    /**
     78
     79
     80
    6681     * @since 5.5.0
    6782     * @var array
     
    7085
    7186    /**
     87
     88
    7289     * @since 5.5.0
    7390     * @var string|null
     
    7693
    7794    /**
     95
     96
    7897     * @since 5.5.0
    7998     * @var array
     
    82101
    83102    /**
     103
     104
    84105     * @since 5.5.0
    85106     * @var array|null
     
    88109
    89110    /**
     111
     112
    90113     * @since 5.5.0
    91114     * @var array|null
     
    167190     *
    168191     * @param string       $block_type Block type name including namespace.
    169      * @param array|string $args       Optional. Array or string of arguments for registering a block type.
    170      *                                 Default empty array.
     192     * @param array|string $args       {
     193     *     Optional. Array or string of arguments for registering a block type. Any arguments may be defined,
     194     *     however the ones described below are supported by default. Default empty array.
     195     *
     196     *
     197     *     @type string        $title            Human-readable block type label.
     198     *     @type string|null   $category         Block type category classification, used in
     199     *                                           search interfaces to arrange block types by category.
     200     *     @type array|null    $parent           Setting parent lets a block require that it is only
     201     *                                           available when nested within the specified blocks.
     202     *     @type string|null   $icon             Block type icon.
     203     *     @type string        $description      A detailed block type description.
     204     *     @type array         $keywords         Additional keywords to produce block type as
     205     *                                           result in search interfaces.
     206     *     @type string|null   $textdomain       The translation textdomain.
     207     *     @type array         $styles           Alternative block styles.
     208     *     @type array|null    $supports         Supported features.
     209     *     @type array|null    $example          Structured data for the block preview.
     210     *     @type callable|null $render_callback  Block type render callback.
     211     *     @type array|null    $attributes       Block type attributes property schemas.
     212     *     @type array         $uses_context     Context values inherited by blocks of this type.
     213     *     @type array|null    $provides_context Context provided by blocks of this type.
     214     *     @type string|null   $editor_script    Block type editor script handle.
     215     *     @type string|null   $script           Block type front end script handle.
     216     *     @type string|null   $editor_style     Block type editor style handle.
     217     *     @type string|null   $style            Block type front end style handle.
     218     * }
    171219     */
    172220    public function __construct( $block_type, $args = array() ) {
     
    260308     *
    261309     * @param array|string $args Array or string of arguments for registering a block type.
     310
    262311     */
    263312    public function set_props( $args ) {
Note: See TracChangeset for help on using the changeset viewer.