Skip to content

Commit

Permalink
Docs: Docblock corrections for get_block_file_template().
Browse files Browse the repository at this point in the history
Follow-up to [52324].

Props johnbillion, SergeyBiryukov, costdev.
Fixes #54879.

Built from https://develop.svn.wordpress.org/trunk@52631


git-svn-id: https://core.svn.wordpress.org/trunk@52219 1a063a9b-81f0-0310-95a4-ce76da25c4cd
  • Loading branch information
audrasjb committed Jan 24, 2022
1 parent b58f5f2 commit 77e13e7
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 21 deletions.
40 changes: 20 additions & 20 deletions wp-includes/block-template-utils.php
Original file line number Diff line number Diff line change
Expand Up @@ -498,8 +498,8 @@ function _remove_theme_attribute_in_block_template_content( $template_content )
* @since 5.9.0
* @access private
*
* @param array $template_file Theme file.
* @param array $template_type 'wp_template' or 'wp_template_part'.
* @param array $template_file Theme file.
* @param string $template_type 'wp_template' or 'wp_template_part'.
*
* @return WP_Block_Template Template.
*/
Expand Down Expand Up @@ -600,15 +600,15 @@ function _build_block_template_result_from_post( $post ) {
*
* @since 5.8.0
*
* @param array $query {
* @param array $query {
* Optional. Arguments to retrieve templates.
*
* @type array $slug__in List of slugs to include.
* @type int $wp_id Post ID of customized template.
* @type string $area A 'wp_template_part_area' taxonomy value to filter by (for wp_template_part template type only).
* @type string $post_type Post type to get the templates for.
* }
* @param array $template_type 'wp_template' or 'wp_template_part'.
* @param string $template_type 'wp_template' or 'wp_template_part'.
*
* @return array Templates.
*/
Expand All @@ -622,14 +622,14 @@ function get_block_templates( $query = array(), $template_type = 'wp_template' )
*
* @param WP_Block_Template[]|null $block_templates Return an array of block templates to short-circuit the default query,
* or null to allow WP to run it's normal queries.
* @param array $query {
* @param array $query {
* Optional. Arguments to retrieve templates.
*
* @type array $slug__in List of slugs to include.
* @type int $wp_id Post ID of customized template.
* @type string $post_type Post type to get the templates for.
* }
* @param array $template_type wp_template or wp_template_part.
* @param string $template_type wp_template or wp_template_part.
*/
$templates = apply_filters( 'pre_get_block_templates', null, $query, $template_type );
if ( ! is_null( $templates ) ) {
Expand Down Expand Up @@ -725,13 +725,13 @@ function get_block_templates( $query = array(), $template_type = 'wp_template' )
* @since 5.9.0
*
* @param WP_Block_Template[] $query_result Array of found block templates.
* @param array $query {
* @param array $query {
* Optional. Arguments to retrieve templates.
*
* @type array $slug__in List of slugs to include.
* @type int $wp_id Post ID of customized template.
* }
* @param array $template_type wp_template or wp_template_part.
* @param string $template_type wp_template or wp_template_part.
*/
return apply_filters( 'get_block_templates', $query_result, $query, $template_type );
}
Expand All @@ -742,7 +742,7 @@ function get_block_templates( $query = array(), $template_type = 'wp_template' )
* @since 5.8.0
*
* @param string $id Template unique identifier (example: theme_slug//template_slug).
* @param array $template_type Optional. Template type: `'wp_template'` or '`wp_template_part'`.
* @param string $template_type Optional. Template type: `'wp_template'` or '`wp_template_part'`.
* Default `'wp_template'`.
*
* @return WP_Block_Template|null Template.
Expand All @@ -758,7 +758,7 @@ function get_block_template( $id, $template_type = 'wp_template' ) {
* @param WP_Block_Template|null $block_template Return block template object to short-circuit the default query,
* or null to allow WP to run its normal queries.
* @param string $id Template unique identifier (example: theme_slug//template_slug).
* @param array $template_type Template type: `'wp_template'` or '`wp_template_part'`.
* @param string $template_type Template type: `'wp_template'` or '`wp_template_part'`.
*/
$block_template = apply_filters( 'pre_get_block_template', null, $id, $template_type );
if ( ! is_null( $block_template ) ) {
Expand Down Expand Up @@ -815,22 +815,22 @@ function get_block_template( $id, $template_type = 'wp_template' ) {
* @since 5.9.0
*
* @param string $id Template unique identifier (example: theme_slug//template_slug).
* @param array $template_type Optional. Template type: `'wp_template'` or '`wp_template_part'`.
* @param string $template_type Optional. Template type: `'wp_template'` or '`wp_template_part'`.
* Default `'wp_template'`.
* @return WP_Block_Template|null The found block template, or null if there isn't one.
*/
function get_block_file_template( $id, $template_type = 'wp_template' ) {
/**
* Filters the block templates array before the query takes place.
*
* Return a non-null value to bypass the WordPress queries.
*
*
* @since 5.9.0
*
* @param WP_Block_Template|null $block_template Return block template object to short-circuit the default query,
* or null to allow WP to run its normal queries.
* @param string $id Template unique identifier (example: theme_slug//template_slug).
* @param array $template_type Template type: `'wp_template'` or '`wp_template_part'`.
* @param string $id Template unique identifier (example: theme_slug//template_slug).
* @param string $template_type Template type: `'wp_template'` or '`wp_template_part'`.
*/
$block_template = apply_filters( 'pre_get_block_file_template', null, $id, $template_type );
if ( ! is_null( $block_template ) ) {
Expand All @@ -839,19 +839,19 @@ function get_block_file_template( $id, $template_type = 'wp_template' ) {

$parts = explode( '//', $id, 2 );
if ( count( $parts ) < 2 ) {
/** This filter is documented at the end of this function */
/** This filter is documented in wp-includes/block-template-utils.php */
return apply_filters( 'get_block_file_template', null, $id, $template_type );
}
list( $theme, $slug ) = $parts;

if ( wp_get_theme()->get_stylesheet() !== $theme ) {
/** This filter is documented at the end of this function */
/** This filter is documented in wp-includes/block-template-utils.php */
return apply_filters( 'get_block_file_template', null, $id, $template_type );
}

$template_file = _get_block_template_file( $template_type, $slug );
if ( null === $template_file ) {
/** This filter is documented at the end of this function */
/** This filter is documented in wp-includes/block-template-utils.php */
return apply_filters( 'get_block_file_template', null, $id, $template_type );
}

Expand All @@ -862,9 +862,9 @@ function get_block_file_template( $id, $template_type = 'wp_template' ) {
*
* @since 5.9.0
*
* @param WP_Block_Template $block_template The found block template.
* @param string $id Template unique identifier (example: theme_slug//template_slug).
* @param array $template_type Template type: `'wp_template'` or '`wp_template_part'`.
* @param WP_Block_Template|null $block_template The found block template, or null if there is none.
* @param string $id Template unique identifier (example: theme_slug//template_slug).
* @param string $template_type Template type: `'wp_template'` or '`wp_template_part'`.
*/
return apply_filters( 'get_block_file_template', $block_template, $id, $template_type );
}
Expand Down
2 changes: 1 addition & 1 deletion wp-includes/version.php
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
*
* @global string $wp_version
*/
$wp_version = '6.0-alpha-52628';
$wp_version = '6.0-alpha-52631';

/**
* Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema.
Expand Down

0 comments on commit 77e13e7

Please sign in to comment.