WordPress.org

Make WordPress Core

Changeset 47240


Ignore:
Timestamp:
02/10/2020 05:50:36 PM (8 months ago)
Author:
jorgefilipecosta
Message:

Block Editor: Backport inclusion of new editor settings to the core.

This commit includes in the core settings for the gradients theme API stabilized in https://github.com/WordPress/gutenberg/pull/20107, and for the image sizes required for the latest posts feature image https://github.com/WordPress/gutenberg/pull/17151/.

Props: youknowriad, ryelle.
Fixes #49389.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/wp-admin/edit-form-blocks.php

    r47198 r47240  
    133133 */
    134134
    135 $align_wide    = get_theme_support( 'align-wide' );
    136 $color_palette = current( (array) get_theme_support( 'editor-color-palette' ) );
    137 $font_sizes    = current( (array) get_theme_support( 'editor-font-sizes' ) );
     135$align_wide       = get_theme_support( 'align-wide' );
     136$color_palette    = current( (array) get_theme_support( 'editor-color-palette' ) );
     137$font_sizes       = current( (array) get_theme_support( 'editor-font-sizes' ) );
     138$gradient_presets = current( (array) get_theme_support( 'editor-gradient-presets' ) );
    138139
    139140/**
     
    227228}
    228229
     230$image_dimensions = array();
     231$all_sizes        = wp_get_registered_image_subsizes();
     232foreach ( $available_image_sizes as $size ) {
     233    $key = $size['slug'];
     234    if ( isset( $all_sizes[ $key ] ) ) {
     235        $image_dimensions[ $key ] = $all_sizes[ $key ];
     236    }
     237}
     238
    229239// Lock settings.
    230240$user_id = wp_check_post_lock( $post->ID );
     
    279289    'disableCustomColors'    => get_theme_support( 'disable-custom-colors' ),
    280290    'disableCustomFontSizes' => get_theme_support( 'disable-custom-font-sizes' ),
     291    'disableCustomGradients' => get_theme_support( 'disable-custom-gradients' ),
    281292    'disablePostFormats'     => ! current_theme_supports( 'post-formats' ),
    282293    /** This filter is documented in wp-admin/edit-form-advanced.php */
     
    289300    'styles'                 => $styles,
    290301    'imageSizes'             => $available_image_sizes,
     302    'imageDimensions'        => $image_dimensions,
    291303    'richEditingEnabled'     => user_can_richedit(),
    292304    'postLock'               => $lock_details,
     
    319331if ( false !== $font_sizes ) {
    320332    $editor_settings['fontSizes'] = $font_sizes;
     333}
     334
     335if ( false !== $gradient_presets ) {
     336    $editor_settings['gradients'] = $gradient_presets;
    321337}
    322338
Note: See TracChangeset for help on using the changeset viewer.