Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
  • Loading branch information
aristath committed Jun 8, 2021
1 parent 38d47a9 commit 843b6c4
Showing 1 changed file with 16 additions and 0 deletions.
16 changes: 16 additions & 0 deletions src/wp-includes/blocks.php
Original file line number Diff line number Diff line change
Expand Up @@ -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',
Expand Down

0 comments on commit 843b6c4

Please sign in to comment.