On this page
_add_block_template_part_area_info( array $template_info ): array
This function’s access is marked private. This means it is not intended for use by plugin or theme developers, only in other core functions. It is listed here for completeness.
Attempts to add the template part’s area information to the input template.
Parameters
$template_infoarray Required-
Template to add information to (requires
'type'and'slug'fields).
Return
array Template info.
Source
File: wp-includes/block-template-utils.php. View all references
function _add_block_template_part_area_info( $template_info ) {
if ( WP_Theme_JSON_Resolver::theme_has_support() ) {
$theme_data = WP_Theme_JSON_Resolver::get_theme_data()->get_template_parts();
}
if ( isset( $theme_data[ $template_info['slug'] ]['area'] ) ) {
$template_info['title'] = $theme_data[ $template_info['slug'] ]['title'];
$template_info['area'] = _filter_block_template_part_area( $theme_data[ $template_info['slug'] ]['area'] );
} else {
$template_info['area'] = WP_TEMPLATE_PART_AREA_UNCATEGORIZED;
}
return $template_info;
}
Related
Uses
| Uses | Description |
|---|---|
| _filter_block_template_part_area() wp-includes/block-template-utils.php | Checks whether the input ‘area’ is a supported value. |
| WP_Theme_JSON_Resolver::theme_has_support() wp-includes/class-wp-theme-json-resolver.php | Determines whether the active theme has a theme.json file. |
| WP_Theme_JSON_Resolver::get_theme_data() wp-includes/class-wp-theme-json-resolver.php | Returns the theme’s data. |
Used By
| Used By | Description |
|---|---|
| _get_block_template_file() wp-includes/block-template-utils.php | Retrieves the template file from the theme for a given slug. |
| _get_block_templates_files() wp-includes/block-template-utils.php | Retrieves the template files from the theme. |
Changelog
| Version | Description |
|---|---|
| 5.9.0 | Introduced. |
© 2003–2022 WordPress Foundation
Licensed under the GNU GPLv2+ License.
https://developer.wordpress.org/reference/functions/_add_block_template_part_area_info