mirror of
https://github.com/WordPress/WordPress.git
synced 2024-11-05 02:10:45 +01:00
f067011b59
The `$post_types` and `$area` properties are assigned in the `_build_block_template_result_from_file()` and `_build_block_template_result_from_post()` functions. However, neither property was explicitly declared in the `WP_Block_Template` class. This commit explicitly declares both properties in the class. Why? (1) To make the code more readable and maintainable; (2) to avoid a `Deprecated: Creation of dynamic property WP_Block_Template::$post_types is deprecated` deprecation when PHP 8.2 is released. Ref: * PHP 8.2 Deprecate dynamic properties https://wiki.php.net/rfc/deprecate_dynamic_properties Follow-up to [52062]. Props jrf. Fixes #54670. Built from https://develop.svn.wordpress.org/trunk@52397 git-svn-id: http://core.svn.wordpress.org/trunk@51989 1a063a9b-81f0-0310-95a4-ce76da25c4cd
149 lines
1.8 KiB
PHP
149 lines
1.8 KiB
PHP
<?php
|
|
/**
|
|
* Blocks API: WP_Block_Template class
|
|
*
|
|
* @package WordPress
|
|
* @since 5.8.0
|
|
*/
|
|
|
|
/**
|
|
* Class representing a block template.
|
|
*
|
|
* @since 5.8.0
|
|
*/
|
|
class WP_Block_Template {
|
|
|
|
/**
|
|
* Type: wp_template.
|
|
*
|
|
* @since 5.8.0
|
|
* @var string
|
|
*/
|
|
public $type;
|
|
|
|
/**
|
|
* Theme.
|
|
*
|
|
* @since 5.8.0
|
|
* @var string
|
|
*/
|
|
public $theme;
|
|
|
|
/**
|
|
* Template slug.
|
|
*
|
|
* @since 5.8.0
|
|
* @var string
|
|
*/
|
|
public $slug;
|
|
|
|
/**
|
|
* ID.
|
|
*
|
|
* @since 5.8.0
|
|
* @var string
|
|
*/
|
|
public $id;
|
|
|
|
/**
|
|
* Title.
|
|
*
|
|
* @since 5.8.0
|
|
* @var string
|
|
*/
|
|
public $title = '';
|
|
|
|
/**
|
|
* Content.
|
|
*
|
|
* @since 5.8.0
|
|
* @var string
|
|
*/
|
|
public $content = '';
|
|
|
|
/**
|
|
* Description.
|
|
*
|
|
* @since 5.8.0
|
|
* @var string
|
|
*/
|
|
public $description = '';
|
|
|
|
/**
|
|
* Source of the content. `theme` and `custom` is used for now.
|
|
*
|
|
* @since 5.8.0
|
|
* @var string
|
|
*/
|
|
public $source = 'theme';
|
|
|
|
/**
|
|
* Origin of the content when the content has been customized.
|
|
* When customized, origin takes on the value of source and source becomes
|
|
* 'custom'.
|
|
*
|
|
* @since 5.9.0
|
|
* @var string
|
|
*/
|
|
public $origin;
|
|
|
|
/**
|
|
* Post ID.
|
|
*
|
|
* @since 5.8.0
|
|
* @var int|null
|
|
*/
|
|
public $wp_id;
|
|
|
|
/**
|
|
* Template Status.
|
|
*
|
|
* @since 5.8.0
|
|
* @var string
|
|
*/
|
|
public $status;
|
|
|
|
/**
|
|
* Whether a template is, or is based upon, an existing template file.
|
|
*
|
|
* @since 5.8.0
|
|
* @var bool
|
|
*/
|
|
public $has_theme_file;
|
|
|
|
/**
|
|
* Whether a template is a custom template.
|
|
*
|
|
* @since 5.9.0
|
|
*
|
|
* @var bool
|
|
*/
|
|
public $is_custom = true;
|
|
|
|
/**
|
|
* Author.
|
|
*
|
|
* A value of 0 means no author.
|
|
*
|
|
* @since 5.9.0
|
|
* @var int
|
|
*/
|
|
public $author;
|
|
|
|
/**
|
|
* Post types.
|
|
*
|
|
* @since 5.9.0
|
|
* @var array
|
|
*/
|
|
public $post_types;
|
|
|
|
/**
|
|
* Area.
|
|
*
|
|
* @since 5.9.0
|
|
* @var string
|
|
*/
|
|
public $area;
|
|
}
|