Make WordPress Core

Changeset 52219


Ignore:
Timestamp:
11/19/2021 07:04:01 PM (3 years ago)
Author:
desrosj
Message:

Docs: Improve the documentation for registering block patterns and block pattern categories.

This expands the @param tag for the property argument available for the register() method in WP_Block_Patterns_Registry and WP_Block_Pattern_Cattegories_Registry.

See #53399.

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

Legend:

Unmodified
Added
Removed
  • trunk/src/wp-includes/class-wp-block-pattern-categories-registry.php

    r51154 r52219  
    3434     *
    3535     * @param string $category_name       Pattern category name including namespace.
    36      * @param array  $category_properties Array containing the properties of the category: label.
     36     * @param array  $category_properties {
     37     *     List of properties for the block pattern category.
     38     *
     39     *     @type string $label Required. A human-readable label for the pattern category.
     40     * }
    3741     * @return bool True if the pattern was registered with success and false otherwise.
    3842     */
     
    142146 *
    143147 * @param string $category_name       Pattern category name including namespace.
    144  * @param array  $category_properties Array containing the properties of the category.
     148 * @param array  $category_properties List of properties for the block pattern.
     149 *                                    See WP_Block_Pattern_Categories_Registry::register() for
     150 *                                    accepted arguments.
    145151 * @return bool True if the pattern category was registered with success and false otherwise.
    146152 */
  • trunk/src/wp-includes/class-wp-block-patterns-registry.php

    r51154 r52219  
    3636     *
    3737     * @param string $pattern_name       Pattern name including namespace.
    38      * @param array  $pattern_properties Array containing the properties of the pattern: title,
    39      *                                   content, description, viewportWidth, categories, keywords.
     38     * @param array $pattern_properties  {
     39     *     List of properties for the block pattern.
     40     *
     41     *     @type string $title         Required. A human-readable title for the pattern.
     42     *     @type string $content       Required. Block HTML markup for the pattern.
     43     *     @type string $description   Visually hidden text used to describe the pattern in the
     44     *                                 inserter. A description is optional, but is strongly
     45     *                                 encouraged when the title does not fully describe what the
     46     *                                 pattern does. The description will help users discover the
     47     *                                 pattern while searching. Optional.
     48     *     @type int    $viewportWidth The intended width of the pattern to allow for a scaled
     49     *                                 preview within the pattern inserter. Optional.
     50     *     @type array  $categories    A list of registered pattern categories used to group block
     51     *                                 patterns. Block patterns can be shown on multiple categories.
     52     *                                 A category must be registered separately in order to be used
     53     *                                 here. Optional.
     54     *     @type array  $keywords      A list of aliases or keywords that help users discover the
     55     *                                 pattern while searching. Optional.
     56     * }
    4057     * @return bool True if the pattern was registered with success and false otherwise.
    4158     */
     
    164181 *
    165182 * @param string $pattern_name       Pattern name including namespace.
    166  * @param array  $pattern_properties Array containing the properties of the pattern.
     183 * @param array  $pattern_properties List of properties for the block pattern.
     184 *                                   See WP_Block_Patterns_Registry::register() for accepted arguments.
    167185 * @return bool True if the pattern was registered with success and false otherwise.
    168186 */
     
    170188    return WP_Block_Patterns_Registry::get_instance()->register( $pattern_name, $pattern_properties );
    171189}
    172 
    173190/**
    174191 * Unregisters a pattern.
Note: See TracChangeset for help on using the changeset viewer.