From ab2dcd8303d5aac0aeb4d7d83e82309001490f7e Mon Sep 17 00:00:00 2001 From: desrosj Date: Fri, 19 Nov 2021 19:05:59 +0000 Subject: [PATCH] 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. Built from https://develop.svn.wordpress.org/trunk@52219 git-svn-id: http://core.svn.wordpress.org/trunk@51811 1a063a9b-81f0-0310-95a4-ce76da25c4cd --- ...s-wp-block-pattern-categories-registry.php | 10 ++++++-- .../class-wp-block-patterns-registry.php | 25 ++++++++++++++++--- wp-includes/version.php | 2 +- 3 files changed, 30 insertions(+), 7 deletions(-) diff --git a/wp-includes/class-wp-block-pattern-categories-registry.php b/wp-includes/class-wp-block-pattern-categories-registry.php index 82cb80ce28..9891214d3d 100644 --- a/wp-includes/class-wp-block-pattern-categories-registry.php +++ b/wp-includes/class-wp-block-pattern-categories-registry.php @@ -33,7 +33,11 @@ final class WP_Block_Pattern_Categories_Registry { * @since 5.5.0 * * @param string $category_name Pattern category name including namespace. - * @param array $category_properties Array containing the properties of the category: label. + * @param array $category_properties { + * List of properties for the block pattern category. + * + * @type string $label Required. A human-readable label for the pattern category. + * } * @return bool True if the pattern was registered with success and false otherwise. */ public function register( $category_name, $category_properties ) { @@ -141,7 +145,9 @@ final class WP_Block_Pattern_Categories_Registry { * @since 5.5.0 * * @param string $category_name Pattern category name including namespace. - * @param array $category_properties Array containing the properties of the category. + * @param array $category_properties List of properties for the block pattern. + * See WP_Block_Pattern_Categories_Registry::register() for + * accepted arguments. * @return bool True if the pattern category was registered with success and false otherwise. */ function register_block_pattern_category( $category_name, $category_properties ) { diff --git a/wp-includes/class-wp-block-patterns-registry.php b/wp-includes/class-wp-block-patterns-registry.php index 7496b445c2..82e7b58d44 100644 --- a/wp-includes/class-wp-block-patterns-registry.php +++ b/wp-includes/class-wp-block-patterns-registry.php @@ -35,8 +35,25 @@ final class WP_Block_Patterns_Registry { * @since 5.5.0 * * @param string $pattern_name Pattern name including namespace. - * @param array $pattern_properties Array containing the properties of the pattern: title, - * content, description, viewportWidth, categories, keywords. + * @param array $pattern_properties { + * List of properties for the block pattern. + * + * @type string $title Required. A human-readable title for the pattern. + * @type string $content Required. Block HTML markup for the pattern. + * @type string $description Visually hidden text used to describe the pattern in the + * inserter. A description is optional, but is strongly + * encouraged when the title does not fully describe what the + * pattern does. The description will help users discover the + * pattern while searching. Optional. + * @type int $viewportWidth The intended width of the pattern to allow for a scaled + * preview within the pattern inserter. Optional. + * @type array $categories A list of registered pattern categories used to group block + * patterns. Block patterns can be shown on multiple categories. + * A category must be registered separately in order to be used + * here. Optional. + * @type array $keywords A list of aliases or keywords that help users discover the + * pattern while searching. Optional. + * } * @return bool True if the pattern was registered with success and false otherwise. */ public function register( $pattern_name, $pattern_properties ) { @@ -163,13 +180,13 @@ final class WP_Block_Patterns_Registry { * @since 5.5.0 * * @param string $pattern_name Pattern name including namespace. - * @param array $pattern_properties Array containing the properties of the pattern. + * @param array $pattern_properties List of properties for the block pattern. + * See WP_Block_Patterns_Registry::register() for accepted arguments. * @return bool True if the pattern was registered with success and false otherwise. */ function register_block_pattern( $pattern_name, $pattern_properties ) { return WP_Block_Patterns_Registry::get_instance()->register( $pattern_name, $pattern_properties ); } - /** * Unregisters a pattern. * diff --git a/wp-includes/version.php b/wp-includes/version.php index 21d294e350..dec94399a2 100644 --- a/wp-includes/version.php +++ b/wp-includes/version.php @@ -16,7 +16,7 @@ * * @global string $wp_version */ -$wp_version = '5.9-alpha-52218'; +$wp_version = '5.9-alpha-52219'; /** * Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema.