Editor: Fix server-side attribute registration via typography support.

Ensures the `fontFamily` attribute is registered for block types on the server side. This change resolves a `400` error when attempting to change the font family for a server-side rendered block in the editor.

Props aaronrobertshaw, mamaduka, wildworks, upadalavipul.
See #56467.

git-svn-id: https://develop.svn.wordpress.org/trunk@54387 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
David Baumwald 2022-10-04 16:45:25 +00:00
parent ad31d53c64
commit eb2d907b3e

View File

@ -57,6 +57,12 @@ function wp_register_typography_support( $block_type ) {
'type' => 'string',
);
}
if ( $has_font_family_support && ! array_key_exists( 'fontFamily', $block_type->attributes ) ) {
$block_type->attributes['fontFamily'] = array(
'type' => 'string',
);
}
}
/**