Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Block Editor: Bring back imageDefaultSize shim for WP 5.7 #30955

Merged
merged 1 commit into from
Apr 19, 2021
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 9 additions & 0 deletions lib/editor-settings.php
Original file line number Diff line number Diff line change
Expand Up @@ -8,11 +8,20 @@
/**
* Extends the block editor with settings that are only in the plugin.
*
* This is a temporary solution until the Gutenberg plugin sets
* the required WordPress version to 5.8.
*
* @see https://core.trac.wordpress.org/ticket/52920
*
* @param array $settings Existing editor settings.
*
* @return array Filtered settings.
*/
function gutenberg_extend_post_editor_settings( $settings ) {
$image_default_size = get_option( 'image_default_size', 'large' );
$image_sizes = wp_list_pluck( $settings['imageSizes'], 'slug' );

$settings['imageDefaultSize'] = in_array( $image_default_size, $image_sizes, true ) ? $image_default_size : 'large';
$settings['__unstableEnableFullSiteEditingBlocks'] = gutenberg_supports_block_templates();

return $settings;
Expand Down