Make WordPress Core


Ignore:
Timestamp:
06/15/2021 08:50:26 AM (3 years ago)
Author:
youknowriad
Message:

Block Editor: Update the WordPress packages with the fixes for 5.8 beta 2.

This includes:

Various

Template Editor

Widgets Editor

Global Styles (theme.json)

Performance

Props nosolosw, jorgefilipecosta, aristath, ntsekouras, peterwilsoncc, mcsf.
See #53397.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/wp-includes/block-editor.php

    r51090 r51149  
    226226    }
    227227
     228    return $editor_settings;
     229}
     230
     231/**
     232 * Returns the block editor settings needed to use the Legacy Widget block which
     233 * is not registered by default.
     234 *
     235 * @since 5.8.0
     236 *
     237 * @return array Settings to be used with get_block_editor_settings().
     238 */
     239function get_legacy_widget_block_editor_settings() {
     240    $editor_settings = array();
     241
    228242    /**
    229243     * Filters the list of widget-type IDs that should **not** be offered by the
     
    297311    $editor_settings['__experimentalFeatures'] = $theme_json->get_settings();
    298312    // These settings may need to be updated based on data coming from theme.json sources.
    299     if ( isset( $editor_settings['__experimentalFeatures']['color']['palette'] ) ) {
    300         $editor_settings['colors'] = $editor_settings['__experimentalFeatures']['color']['palette'];
    301         unset( $editor_settings['__experimentalFeatures']['color']['palette'] );
    302     }
    303     if ( isset( $editor_settings['__experimentalFeatures']['color']['gradients'] ) ) {
    304         $editor_settings['gradients'] = $editor_settings['__experimentalFeatures']['color']['gradients'];
    305         unset( $editor_settings['__experimentalFeatures']['color']['gradients'] );
     313    if ( isset( $settings['__experimentalFeatures']['color']['palette'] ) ) {
     314        $colors_by_origin   = $settings['__experimentalFeatures']['color']['palette'];
     315        $settings['colors'] = isset( $colors_by_origin['user'] ) ?
     316            $colors_by_origin['user'] : (
     317                isset( $colors_by_origin['theme'] ) ?
     318                    $colors_by_origin['theme'] :
     319                    $colors_by_origin['core']
     320            );
     321    }
     322    if ( isset( $settings['__experimentalFeatures']['color']['gradients'] ) ) {
     323        $gradients_by_origin   = $settings['__experimentalFeatures']['color']['gradients'];
     324        $settings['gradients'] = isset( $gradients_by_origin['user'] ) ?
     325            $gradients_by_origin['user'] : (
     326                isset( $gradients_by_origin['theme'] ) ?
     327                    $gradients_by_origin['theme'] :
     328                    $gradients_by_origin['core']
     329            );
     330    }
     331    if ( isset( $settings['__experimentalFeatures']['typography']['fontSizes'] ) ) {
     332        $font_sizes_by_origin  = $settings['__experimentalFeatures']['typography']['fontSizes'];
     333        $settings['fontSizes'] = isset( $font_sizes_by_origin['user'] ) ?
     334            $font_sizes_by_origin['user'] : (
     335                isset( $font_sizes_by_origin['theme'] ) ?
     336                    $font_sizes_by_origin['theme'] :
     337                    $font_sizes_by_origin['core']
     338            );
    306339    }
    307340    if ( isset( $editor_settings['__experimentalFeatures']['color']['custom'] ) ) {
     
    312345        $editor_settings['disableCustomGradients'] = ! $editor_settings['__experimentalFeatures']['color']['customGradient'];
    313346        unset( $editor_settings['__experimentalFeatures']['color']['customGradient'] );
    314     }
    315     if ( isset( $editor_settings['__experimentalFeatures']['typography']['fontSizes'] ) ) {
    316         $editor_settings['fontSizes'] = $editor_settings['__experimentalFeatures']['typography']['fontSizes'];
    317         unset( $editor_settings['__experimentalFeatures']['typography']['fontSizes'] );
    318347    }
    319348    if ( isset( $editor_settings['__experimentalFeatures']['typography']['customFontSize'] ) ) {
Note: See TracChangeset for help on using the changeset viewer.