mirror of
git://develop.git.wordpress.org/
synced 2025-04-01 18:52:34 +02:00
Block Editor: Allow themes to add inline styles for all blocks when using lazy styles loading.
Props aristath. Fixes #53358. git-svn-id: https://develop.svn.wordpress.org/trunk@51102 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
parent
9ae2587b76
commit
716a99587c
@ -209,6 +209,22 @@ function register_block_type_from_metadata( $file_or_folder, $args = array() ) {
|
||||
*/
|
||||
$metadata = apply_filters( 'block_type_metadata', $metadata );
|
||||
|
||||
/**
|
||||
* Add `style` and `editor_style` for core blocks if missing.
|
||||
*
|
||||
* @since 5.8.0
|
||||
*/
|
||||
if ( ! empty( $metadata['name'] ) && 0 === strpos( $metadata['name'], 'core/' ) ) {
|
||||
$block_name = str_replace( 'core/', '', $metadata['name'] );
|
||||
|
||||
if ( ! isset( $metadata['style'] ) ) {
|
||||
$metadata['style'] = "wp-block-$block_name";
|
||||
}
|
||||
if ( ! isset( $metadata['editor_style'] ) ) {
|
||||
$metadata['editor_style'] = "wp-block-$block_name-editor";
|
||||
}
|
||||
}
|
||||
|
||||
$settings = array();
|
||||
$property_mappings = array(
|
||||
'title' => 'title',
|
||||
|
Loading…
x
Reference in New Issue
Block a user