Make WordPress Core

Changeset 55744


Ignore:
Timestamp:
05/11/2023 09:01:55 AM (11 months ago)
Author:
oandregal
Message:

Docs: describe return type of _get_block_template_file().

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

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/wp-includes/block-template-utils.php

    r55732 r55744  
    250250 * @param string $template_type 'wp_template' or 'wp_template_part'.
    251251 * @param string $slug          Template slug.
    252  * @return array|null Template.
     252 * @return array|null {
     253 *    Array with template metadata if $template_type is one of 'wp_template' or 'wp_template_part'.
     254 *    null otherwise.
     255 *
     256 *    @type string   $slug      Template slug.
     257 *    @type string   $path      Template file path.
     258 *    @type string   $theme     Theme slug.
     259 *    @type string   $type      Template type.
     260 *    @type string   $area      Template area. Only for 'wp_template_part'.
     261 *    @type string   $title     Optional. Template title.
     262 *    @type string[] $postTypes Optional. List of post types that the template supports. Only for 'wp_template'.
     263 * }
    253264 */
    254265function _get_block_template_file( $template_type, $slug ) {
     
    358369
    359370            if ( 'wp_template_part' === $template_type ) {
    360                 /*
    361                  * Structure of a wp_template_part item:
    362                  *
    363                  * - slug
    364                  * - path
    365                  * - theme
    366                  * - type
    367                  * - area
    368                  * - title (optional)
    369                  */
    370371                $candidate = _add_block_template_part_area_info( $new_template_item );
    371372                if ( ! isset( $area ) || ( isset( $area ) && $area === $candidate['area'] ) ) {
     
    375376
    376377            if ( 'wp_template' === $template_type ) {
    377                 /*
    378                  * Structure of a wp_template item:
    379                  *
    380                  * - slug
    381                  * - path
    382                  * - theme
    383                  * - type
    384                  * - title (optional)
    385                  * - postTypes (optional)
    386                  */
    387378                $candidate = _add_block_template_info( $new_template_item );
    388379                if (
Note: See TracChangeset for help on using the changeset viewer.