Make WordPress Core

Changes between Initial Version and Version 2 of Ticket #50263


Ignore:
Timestamp:
06/22/2020 11:15:54 AM (6 years ago)
Author:
gziolo
Comment:

Legend:

Unmodified
Added
Removed
Modified
  • Ticket #50263

    • Property Keywords has-patch has-unit-tests added
  • Ticket #50263 – Description

    initial v2  
    77There is also a related task #49615 that proposes `register_block_type_args` filter and might help improve the general experience when registering a block.
    88
    9 This is how the current interface looks like:
     9This is how the interface looks like:
    1010
    1111{{{#!php
    1212<?php
    1313/**
    14  * Registers a block type from metadata stored in the `block.json` file.
    15  *
    16  * @since 5.5.0
    17  *
    18  * @param string $file_or_folder Path to the JSON file with metadata definition for
    19  *     the block or path to the folder where the `block.json` file is located.
    20  * @param array  $args {
    21  *     Optional. Array of block type arguments. Any arguments may be defined, however the
    22  *     ones described below are supported by default. Default empty array.
    23  *
    24  *     @type callable $render_callback Callback used to render blocks of this block type.
    25  * }
    26  * @return WP_Block_Type|false The registered block type on success, or false on failure.
    27  */
    28 function register_block_type_from_metadata( $file_or_folder, $args = array() )
     14  * Registers a block type from metadata stored in the `block.json` file.
     15  *
     16  * @since 5.5.0
     17  *
     18  * @param string $file_or_folder Path to the JSON file with metadata definition for
     19  *     the block or path to the folder where the `block.json` file is located.
     20  * @param array  $args {
     21  *     Optional. Array of block type arguments. Any arguments may be defined, however the
     22  *     ones described below are supported by default. Default empty array.
     23  *
     24  *     @type callable $render_callback Callback used to render blocks of this block type.
     25  * }
     26  * @return WP_Block_Type|false The registered block type on success, or false on failure.
     27  */
     28function register_block_type_from_metadata( $file_or_folder, $args = array() );
    2929}}}