Skip to content

Commit

Permalink
Fix: Color palette is not being stored
Browse files Browse the repository at this point in the history
  • Loading branch information
jorgefilipecosta committed Nov 24, 2021
1 parent d63a847 commit a7fef27
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 2 deletions.
3 changes: 2 additions & 1 deletion lib/class-wp-theme-json-gutenberg.php
Expand Up @@ -303,7 +303,8 @@ public function __construct( $theme_json = array(), $origin = 'theme' ) {
$path = array_merge( $node['path'], $preset_metadata['path'] );
$preset = _wp_array_get( $this->theme_json, $path, null );
if ( null !== $preset ) {
if ( 'user' !== $origin || isset( $preset[0] ) ) {
// If the preset is not already keyed by origin.
if ( isset( $preset[0] ) || empty( $preset ) ) {
_wp_array_set( $this->theme_json, $path, array( $origin => $preset ) );
}
}
Expand Down
Expand Up @@ -220,7 +220,7 @@ public function prepare_item_for_response( $post, $request ) { // phpcs:ignore V
$is_global_styles_user_theme_json = isset( $raw_config['isGlobalStylesUserThemeJSON'] ) && true === $raw_config['isGlobalStylesUserThemeJSON'];
$config = array();
if ( $is_global_styles_user_theme_json ) {
$config = ( new WP_Theme_JSON_Gutenberg( $raw_config, 'user' ) )->get_raw_data();
$config = ( new WP_Theme_JSON_Gutenberg( $raw_config, 'custom' ) )->get_raw_data();
}

$fields = $this->get_fields_for_response( $request );
Expand Down

0 comments on commit a7fef27

Please sign in to comment.