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
This commit is contained in:
desrosj 2021-11-19 19:05:59 +00:00
parent 807cba060e
commit ab2dcd8303
3 changed files with 30 additions and 7 deletions

View File

@ -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 ) {

View File

@ -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.
*

View File

@ -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.