Docs: describe return type of `_get_block_template_file()`.

Props: desrosj, mukesh27, costdev, johnbillion.
Fixes #57756.

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


git-svn-id: http://core.svn.wordpress.org/trunk@55256 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
oandregal 2023-05-11 09:03:26 +00:00
parent fe27bb8d0b
commit 7119126dc3
2 changed files with 13 additions and 22 deletions

View File

@ -249,7 +249,18 @@ function _get_block_templates_paths( $base_directory ) {
* *
* @param string $template_type 'wp_template' or 'wp_template_part'. * @param string $template_type 'wp_template' or 'wp_template_part'.
* @param string $slug Template slug. * @param string $slug Template slug.
* @return array|null Template. * @return array|null {
* Array with template metadata if $template_type is one of 'wp_template' or 'wp_template_part'.
* null otherwise.
*
* @type string $slug Template slug.
* @type string $path Template file path.
* @type string $theme Theme slug.
* @type string $type Template type.
* @type string $area Template area. Only for 'wp_template_part'.
* @type string $title Optional. Template title.
* @type string[] $postTypes Optional. List of post types that the template supports. Only for 'wp_template'.
* }
*/ */
function _get_block_template_file( $template_type, $slug ) { function _get_block_template_file( $template_type, $slug ) {
if ( 'wp_template' !== $template_type && 'wp_template_part' !== $template_type ) { if ( 'wp_template' !== $template_type && 'wp_template_part' !== $template_type ) {
@ -357,16 +368,6 @@ function _get_block_templates_files( $template_type, $query = array() ) {
); );
if ( 'wp_template_part' === $template_type ) { if ( 'wp_template_part' === $template_type ) {
/*
* Structure of a wp_template_part item:
*
* - slug
* - path
* - theme
* - type
* - area
* - title (optional)
*/
$candidate = _add_block_template_part_area_info( $new_template_item ); $candidate = _add_block_template_part_area_info( $new_template_item );
if ( ! isset( $area ) || ( isset( $area ) && $area === $candidate['area'] ) ) { if ( ! isset( $area ) || ( isset( $area ) && $area === $candidate['area'] ) ) {
$template_files[] = $candidate; $template_files[] = $candidate;
@ -374,16 +375,6 @@ function _get_block_templates_files( $template_type, $query = array() ) {
} }
if ( 'wp_template' === $template_type ) { if ( 'wp_template' === $template_type ) {
/*
* Structure of a wp_template item:
*
* - slug
* - path
* - theme
* - type
* - title (optional)
* - postTypes (optional)
*/
$candidate = _add_block_template_info( $new_template_item ); $candidate = _add_block_template_info( $new_template_item );
if ( if (
! $post_type || ! $post_type ||

View File

@ -16,7 +16,7 @@
* *
* @global string $wp_version * @global string $wp_version
*/ */
$wp_version = '6.3-alpha-55743'; $wp_version = '6.3-alpha-55744';
/** /**
* Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema. * Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema.