Themes: Allow files in a block theme's 'patterns' directory to be filterable.
Since [59872] all PHP files in the 'patterns' directory or subdirectories are auto registered. Adding a filter prior to autoregistration allows theme developers to modify the list of files before the auto registration. Reviewed by audrasjb. Merges [60142] to the 6.8 branch Props webmandesign, joemcgill, jorbin, poena. Fixes #63212. Built from https://develop.svn.wordpress.org/branches/6.8@60144 git-svn-id: http://core.svn.wordpress.org/branches/6.8@59480 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
@@ -1860,6 +1860,16 @@ final class WP_Theme implements ArrayAccess {
|
|||||||
|
|
||||||
$files = (array) self::scandir( $dirpath, 'php', -1 );
|
$files = (array) self::scandir( $dirpath, 'php', -1 );
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Filters list of block pattern files for a theme.
|
||||||
|
*
|
||||||
|
* @since 6.8.0
|
||||||
|
*
|
||||||
|
* @param array $files Array of theme files found within `patterns` directory.
|
||||||
|
* @param string $dirpath Path of theme `patterns` directory being scanned.
|
||||||
|
*/
|
||||||
|
$files = apply_filters( 'theme_block_pattern_files', $files, $dirpath );
|
||||||
|
|
||||||
$dirpath = trailingslashit( $dirpath );
|
$dirpath = trailingslashit( $dirpath );
|
||||||
|
|
||||||
if ( ! $files ) {
|
if ( ! $files ) {
|
||||||
|
|||||||
@@ -16,7 +16,7 @@
|
|||||||
*
|
*
|
||||||
* @global string $wp_version
|
* @global string $wp_version
|
||||||
*/
|
*/
|
||||||
$wp_version = '6.8-RC2-60143';
|
$wp_version = '6.8-RC2-60144';
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema.
|
* Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema.
|
||||||
|
|||||||
Reference in New Issue
Block a user