Editor: Add post types property to wp-rest-block-patterns-controller.php.

Backports PHP changes in WordPress/gutenberg#41791 to the core. Adds the post types property to the rest API patterns endpoint.

Props mcsf, ntsekouras, matveb.
See #56467.

git-svn-id: https://develop.svn.wordpress.org/trunk@54263 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
Jorge Costa
2022-09-20 16:27:44 +00:00
parent 6663deb764
commit 4fbb3b91a1
2 changed files with 10 additions and 1 deletions

View File

@@ -189,6 +189,7 @@ function _register_remote_theme_patterns() {
* - Categories (comma-separated values)
* - Keywords (comma-separated values)
* - Block Types (comma-separated values)
* - Post Types (comma-separated values)
* - Inserter (yes/no)
*
* @since 6.0.0
@@ -203,6 +204,7 @@ function _register_theme_block_patterns() {
'categories' => 'Categories',
'keywords' => 'Keywords',
'blockTypes' => 'Block Types',
'postTypes' => 'Post Types',
'inserter' => 'Inserter',
);
@@ -274,7 +276,7 @@ function _register_theme_block_patterns() {
}
// For properties of type array, parse data as comma-separated.
foreach ( array( 'categories', 'keywords', 'blockTypes' ) as $property ) {
foreach ( array( 'categories', 'keywords', 'blockTypes', 'postTypes' ) as $property ) {
if ( ! empty( $pattern_data[ $property ] ) ) {
$pattern_data[ $property ] = array_filter(
preg_split(