WordPress.org

Make WordPress Core

Ticket #49389: 49389.3.diff

File 49389.3.diff, 2.5 KB (added by jorgefilipecosta, 21 months ago)
  • src/wp-admin/edit-form-blocks.php

     
    132132 * Initialize the editor.
    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/**
    140141 * Filters the allowed block types for the editor, defaulting to true (all
     
    226227        );
    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 );
    231241if ( $user_id ) {
     
    278288        'allowedBlockTypes'      => $allowed_block_types,
    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 */
    283294        'titlePlaceholder'       => apply_filters( 'enter_title_here', __( 'Add title' ), $post ),
     
    288299        'allowedMimeTypes'       => get_allowed_mime_types(),
    289300        'styles'                 => $styles,
    290301        'imageSizes'             => $available_image_sizes,
     302        'imageDimensions'        => $image_dimensions,
    291303        'richEditingEnabled'     => user_can_richedit(),
    292304        'postLock'               => $lock_details,
    293305        'postLockUtils'          => array(
     
    320332        $editor_settings['fontSizes'] = $font_sizes;
    321333}
    322334
     335if ( false !== $gradient_presets ) {
     336        $editor_settings['gradients'] = $gradient_presets;
     337}
     338
    323339if ( ! empty( $post_type_object->template ) ) {
    324340        $editor_settings['template']     = $post_type_object->template;
    325341        $editor_settings['templateLock'] = ! empty( $post_type_object->template_lock ) ? $post_type_object->template_lock : false;