Make WordPress Core


Ignore:
Timestamp:
11/23/2021 05:38:45 AM (3 years ago)
Author:
noisysocks
Message:

Update @wordpress packages

Update packages to include these bug fixes from Gutenberg:

  • FSE: Add welcome guide
  • Update theme styles for the code block
  • Add feature flag to toggle the new site editor sidebar
  • Add templates list page for site editor
  • Cover Block: Fix default background dim
  • E2E: Add more Cover block tests
  • Cover Block: Fix regressions
  • Post Comments Form: ensure typography styles are applied to child elements
  • Navigation: Fix space-between
  • Fix background colours in nested submenus.
  • Fix duplicate custom classnames in navigation submenu block
  • Fix colour rendering in Navigation overlay
  • Fix: Add ability to opt out of Core color palette V2
  • Change @package to WordPress in block-library
  • Make the core color palette opt-in for themes with not theme.json
  • Remove textdomain from calendar block
  • Page List block: fix space before href attribute
  • Try: Let Featured Image block inherit dimensions, look like a placeholder
  • [Global Styles]: Add block icon next to blocks list
  • Page List: Use core entities instead of direct apiFetch
  • Site Editor: Stabilize export endpoint
  • Fix mobile horizontal scrollbar.
  • Multi-entity save: Only set site entity to pending if really saving
  • Add page list to navigation direct insert conditions
  • Implement "Add New" for templates list in Site Editor
  • Post Featured Image: Remove withNotices HOC
  • Fix page list missing button styles when set to open on click.
  • Make appender fixed position to avoid jumps in the UI
  • Color UI component: reorder palettes and update names (core by defaults, user by custom)
  • Remove the Styles link in Site Editor
  • GlobalStyles sidebar: do not show default palette if theme opts-out
  • Only render the site editor canvas when the global styles are ready.
  • Global Styles: rename core origin key to default for presets
  • Clarify i18n context for PostTemplateActions's "New" label
  • Revert erroneous native editor package version bumps
  • Try: Hide the columns inserter in pattern previews.
  • Fix site editor region navigation
  • Update navigation sidebar responsiveness
  • Add _wp_array_set and _wp_to_kebab_case to 5.8 compat
  • Make user able to change all color palette origins
  • Site Editor: Update hrefs to not specifically refer to themes.php?page=gutenberg-edit-site
  • Site Editor: Validate the postType query argument
  • Navigation: Scale submenu icon.
  • Move the theme editor under tools for FSE themes
  • Deprecate navigation areas

See #54487.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/wp-includes/class-wp-theme-json.php

    r52062 r52232  
    5252     */
    5353    const VALID_ORIGINS = array(
    54         'core',
     54        'default',
    5555        'theme',
    5656        'user',
     
    221221        ),
    222222        'color'      => array(
    223             'background'     => null,
    224             'custom'         => null,
    225             'customDuotone'  => null,
    226             'customGradient' => null,
    227             'duotone'        => null,
    228             'gradients'      => null,
    229             'link'           => null,
    230             'palette'        => null,
    231             'text'           => null,
     223            'background'       => null,
     224            'custom'           => null,
     225            'customDuotone'    => null,
     226            'customGradient'   => null,
     227            'defaultGradients' => null,
     228            'defaultPalette'   => null,
     229            'duotone'          => null,
     230            'gradients'        => null,
     231            'link'             => null,
     232            'palette'          => null,
     233            'text'             => null,
    232234        ),
    233235        'custom'     => null,
     
    325327     * @param array $theme_json A structure that follows the theme.json schema.
    326328     * @param string $origin    Optional. What source of data this object represents.
    327      *                          One of 'core', 'theme', or 'user'. Default 'theme'.
     329     *                          One of 'default', 'theme', or 'user'. Default 'theme'.
    328330     */
    329331    public function __construct( $theme_json = array(), $origin = 'theme' ) {
     
    344346                $preset = _wp_array_get( $this->theme_json, $path, null );
    345347                if ( null !== $preset ) {
    346                     _wp_array_set( $this->theme_json, $path, array( $origin => $preset ) );
     348                    if ( 'user' !== $origin || isset( $preset[0] ) ) {
     349                        _wp_array_set( $this->theme_json, $path, array( $origin => $preset ) );
     350                    }
    347351                }
    348352            }
     
    14731477        $output = array();
    14741478        foreach ( self::PRESETS_METADATA as $preset_metadata ) {
    1475             $presets = _wp_array_get( $input, $preset_metadata['path'], null );
    1476             if ( null === $presets ) {
    1477                 continue;
    1478             }
    1479 
    1480             $escaped_preset = array();
    1481             foreach ( $presets as $preset ) {
    1482                 if (
    1483                     esc_attr( esc_html( $preset['name'] ) ) === $preset['name'] &&
    1484                     sanitize_html_class( $preset['slug'] ) === $preset['slug']
    1485                 ) {
    1486                     $value = null;
    1487                     if ( isset( $preset_metadata['value_key'] ) ) {
    1488                         $value = $preset[ $preset_metadata['value_key'] ];
    1489                     } elseif (
    1490                         isset( $preset_metadata['value_func'] ) &&
    1491                         is_callable( $preset_metadata['value_func'] )
     1479            foreach ( self::VALID_ORIGINS as $origin ) {
     1480                $path_with_origin = array_merge( $preset_metadata['path'], array( $origin ) );
     1481                $presets          = _wp_array_get( $input, $path_with_origin, null );
     1482                if ( null === $presets ) {
     1483                    continue;
     1484                }
     1485
     1486                $escaped_preset = array();
     1487                foreach ( $presets as $preset ) {
     1488                    if (
     1489                        esc_attr( esc_html( $preset['name'] ) ) === $preset['name'] &&
     1490                        sanitize_html_class( $preset['slug'] ) === $preset['slug']
    14921491                    ) {
    1493                         $value = call_user_func( $preset_metadata['value_func'], $preset );
    1494                     }
    1495 
    1496                     $preset_is_valid = true;
    1497                     foreach ( $preset_metadata['properties'] as $property ) {
    1498                         if ( ! self::is_safe_css_declaration( $property, $value ) ) {
    1499                             $preset_is_valid = false;
    1500                             break;
     1492                        $value = null;
     1493                        if ( isset( $preset_metadata['value_key'] ) ) {
     1494                            $value = $preset[ $preset_metadata['value_key'] ];
     1495                        } elseif (
     1496                            isset( $preset_metadata['value_func'] ) &&
     1497                            is_callable( $preset_metadata['value_func'] )
     1498                        ) {
     1499                            $value = call_user_func( $preset_metadata['value_func'], $preset );
     1500                        }
     1501
     1502                        $preset_is_valid = true;
     1503                        foreach ( $preset_metadata['properties'] as $property ) {
     1504                            if ( ! self::is_safe_css_declaration( $property, $value ) ) {
     1505                                $preset_is_valid = false;
     1506                                break;
     1507                            }
     1508                        }
     1509
     1510                        if ( $preset_is_valid ) {
     1511                            $escaped_preset[] = $preset;
    15011512                        }
    15021513                    }
    1503 
    1504                     if ( $preset_is_valid ) {
    1505                         $escaped_preset[] = $preset;
    1506                     }
    15071514                }
    1508             }
    1509 
    1510             if ( ! empty( $escaped_preset ) ) {
    1511                 _wp_array_set( $output, $preset_metadata['path'], $escaped_preset );
    1512             }
    1513         }
    1514 
     1515
     1516                if ( ! empty( $escaped_preset ) ) {
     1517                    _wp_array_set( $output, $path_with_origin, $escaped_preset );
     1518                }
     1519            }
     1520        }
    15151521        return $output;
    15161522    }
Note: See TracChangeset for help on using the changeset viewer.