ld match the default ones and * affect the generated CSS. */ if ( isset( $old['settings']['typography']['fontSizes'] ) ) { $new['settings']['typography']['defaultFontSizes'] = false; } /* * Similarly to defaultFontSizes, we need to migrate defaultSpacingSizes * as it controls the PRESETS_METADATA prevent_override which was * previously hardcoded to false. This only needs to happen when the * theme provided spacing sizes via spacingSizes or spacingScale. */ if ( isset( $old['settings']['spacing']['spacingSizes'] ) || isset( $old['settings']['spacing']['spacingScale'] ) ) { $new['settings']['spacing']['defaultSpacingSizes'] = false; } /* * In v3 spacingSizes is merged with the generated spacingScale sizes * instead of completely replacing them. The v3 behavior is what was * documented for the v2 schema, but the code never actually did work * that way. Instead of surprising users with a behavior change two * years after the fact at the same time as a v3 update is introduced, * we'll continue using the "bugged" behavior for v2 themes. And treat * the "bug fix" as a breaking change for v3. */ if ( isset( $old['settings']['spacing']['spacingSizes'] ) ) { unset( $new['settings']['spacing']['spacingScale'] ); } return $new; } /** * Processes the settings subtree. * * @since 5.9.0 * * @param array $settings Array to process. * @param array $paths_to_rename Paths to rename. * * @return array The settings in the new format. */ private static function rename_paths( $settings, $paths_to_rename ) { $new_settings = $settings; // Process any renamed/moved paths within default settings. self::rename_settings( $new_settings, $paths_to_rename ); // Process individual block settings. if ( isset( $new_settings['blocks'] ) && is_array( $new_settings['blocks'] ) ) { foreach ( $new_settings['blocks'] as &$block_settings ) { self::rename_settings( $block_settings, $paths_to_rename ); } } return $new_settings; } /** * Processes a settings array, renaming or moving properties. * * @since 5.9.0 * * @param array $settings Reference to settings either defaults or an individual block's. * @param array $paths_to_rename Paths to rename. */ private static function rename_settings( &$settings, $paths_to_rename ) { foreach ( $paths_to_rename as $original => $renamed ) { $original_path = explode( '.', $original ); $renamed_path = explode( '.', $renamed ); $current_value = _wp_array_get( $settings, $original_path, null ); if ( null !== $current_value ) { _wp_array_set( $settings, $renamed_path, $current_value ); self::unset_setting_by_path( $settings, $original_path ); } } } /** * Removes a property from within the provided settings by its path. * * @since 5.9.0 * * @param array $settings Reference to the current settings array. * @param array $path Path to the property to be removed. */ private static function unset_setting_by_path( &$settings, $path ) { $tmp_settings = &$settings; $last_key = array_pop( $path ); foreach ( $path as $key ) { $tmp_settings = &$tmp_settings[ $key ]; } unset( $tmp_settings[ $last_key ] ); } } Page not found – DentalMa