diff --git a/src/wp-admin/edit-form-blocks.php b/src/wp-admin/edit-form-blocks.php index 3be4e8797a..0d690ef4ae 100644 --- a/src/wp-admin/edit-form-blocks.php +++ b/src/wp-admin/edit-form-blocks.php @@ -132,9 +132,10 @@ wp_localize_script( 'wp-editor', '_wpMetaBoxUrl', $meta_box_url ); * Initialize the editor. */ -$align_wide = get_theme_support( 'align-wide' ); -$color_palette = current( (array) get_theme_support( 'editor-color-palette' ) ); -$font_sizes = current( (array) get_theme_support( 'editor-font-sizes' ) ); +$align_wide = get_theme_support( 'align-wide' ); +$color_palette = current( (array) get_theme_support( 'editor-color-palette' ) ); +$font_sizes = current( (array) get_theme_support( 'editor-font-sizes' ) ); +$gradient_presets = current( (array) get_theme_support( 'editor-gradient-presets' ) ); /** * Filters the allowed block types for the editor, defaulting to true (all @@ -226,6 +227,15 @@ foreach ( $image_size_names as $image_size_slug => $image_size_name ) { ); } +$image_dimensions = array(); +$all_sizes = wp_get_registered_image_subsizes(); +foreach ( $available_image_sizes as $size ) { + $key = $size['slug']; + if ( isset( $all_sizes[ $key ] ) ) { + $image_dimensions[ $key ] = $all_sizes[ $key ]; + } +} + // Lock settings. $user_id = wp_check_post_lock( $post->ID ); if ( $user_id ) { @@ -278,6 +288,7 @@ $editor_settings = array( 'allowedBlockTypes' => $allowed_block_types, 'disableCustomColors' => get_theme_support( 'disable-custom-colors' ), 'disableCustomFontSizes' => get_theme_support( 'disable-custom-font-sizes' ), + 'disableCustomGradients' => get_theme_support( 'disable-custom-gradients' ), 'disablePostFormats' => ! current_theme_supports( 'post-formats' ), /** This filter is documented in wp-admin/edit-form-advanced.php */ 'titlePlaceholder' => apply_filters( 'enter_title_here', __( 'Add title' ), $post ), @@ -288,6 +299,7 @@ $editor_settings = array( 'allowedMimeTypes' => get_allowed_mime_types(), 'styles' => $styles, 'imageSizes' => $available_image_sizes, + 'imageDimensions' => $image_dimensions, 'richEditingEnabled' => user_can_richedit(), 'postLock' => $lock_details, 'postLockUtils' => array( @@ -320,6 +332,10 @@ if ( false !== $font_sizes ) { $editor_settings['fontSizes'] = $font_sizes; } +if ( false !== $gradient_presets ) { + $editor_settings['gradients'] = $gradient_presets; +} + if ( ! empty( $post_type_object->template ) ) { $editor_settings['template'] = $post_type_object->template; $editor_settings['templateLock'] = ! empty( $post_type_object->template_lock ) ? $post_type_object->template_lock : false;