mirror of
https://github.com/WordPress/WordPress.git
synced 2024-11-15 23:25:50 +01:00
ef2b22c001
This commit introduces a new API to allow plugins to easily register block templates with `wp_register_block_template()` and the `WP_Block_Templates_Registry` class, addressing the complexity of hooking into multiple filters. It also ensures plugin-registered templates overridden by themes fall back to the plugin-provided title and description when the theme doesn't define them. See https://github.com/WordPress/gutenberg/pull/61577. See https://github.com/WordPress/gutenberg/pull/64610. Fixes #61804. Props aljullu, peterwilsoncc, antonvlasenko, azaozz, youknowriad, noisysocks. Built from https://develop.svn.wordpress.org/trunk@59073 git-svn-id: http://core.svn.wordpress.org/trunk@58469 1a063a9b-81f0-0310-95a4-ce76da25c4cd
166 lines
2.0 KiB
PHP
166 lines
2.0 KiB
PHP
<?php
|
|
/**
|
|
* Blocks API: WP_Block_Template class
|
|
*
|
|
* @package WordPress
|
|
* @since 5.8.0
|
|
*/
|
|
|
|
/**
|
|
* Class representing a block template.
|
|
*
|
|
* @since 5.8.0
|
|
*/
|
|
#[AllowDynamicProperties]
|
|
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|null
|
|
*/
|
|
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|null
|
|
*/
|
|
public $author;
|
|
|
|
/**
|
|
* Plugin.
|
|
*
|
|
* @since 6.7.0
|
|
* @var string|null
|
|
*/
|
|
public $plugin;
|
|
|
|
/**
|
|
* Post types.
|
|
*
|
|
* @since 5.9.0
|
|
* @var string[]|null
|
|
*/
|
|
public $post_types;
|
|
|
|
/**
|
|
* Area.
|
|
*
|
|
* @since 5.9.0
|
|
* @var string|null
|
|
*/
|
|
public $area;
|
|
|
|
/**
|
|
* Modified.
|
|
*
|
|
* @since 6.3.0
|
|
* @var string|null
|
|
*/
|
|
public $modified;
|
|
}
|