Skip to content

Commit

Permalink
Remove values property, reverting back to attributes being at root …
Browse files Browse the repository at this point in the history
…of `content` attribute
  • Loading branch information
talldan committed Feb 26, 2024
1 parent eb5bc0f commit b667034
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ function gutenberg_block_bindings_pattern_overrides_callback( $source_attrs, $bl
return null;
}
$metadata_name = $block_instance->attributes['metadata']['name'];
return _wp_array_get( $block_instance->context, array( 'pattern/overrides', $metadata_name, 'values', $attribute_name ), null );
return _wp_array_get( $block_instance->context, array( 'pattern/overrides', $metadata_name, $attribute_name ), null );
}

/**
Expand Down
6 changes: 3 additions & 3 deletions packages/block-library/src/block/edit.js
Original file line number Diff line number Diff line change
Expand Up @@ -119,7 +119,7 @@ function applyInitialContentValuesToInnerBlocks(
defaultValues[ metadataName ][ attributeKey ] =
block.attributes[ attributeKey ];

const contentValues = content[ metadataName ]?.values;
const contentValues = content[ metadataName ];
if ( contentValues?.[ attributeKey ] !== undefined ) {
newAttributes[ attributeKey ] = contentValues[ attributeKey ];
}
Expand Down Expand Up @@ -161,10 +161,10 @@ function getContentValuesFromInnerBlocks( blocks, defaultValues ) {
defaultValues[ metadataName ][ attributeKey ]
)
) {
content[ metadataName ] ??= { values: {} };
content[ metadataName ] ??= {};
// TODO: We need a way to represent `undefined` in the serialized overrides.
// Also see: https://github.com/WordPress/gutenberg/pull/57249#discussion_r1452987871
content[ metadataName ].values[ attributeKey ] =
content[ metadataName ][ attributeKey ] =
block.attributes[ attributeKey ] === undefined
? // TODO: We use an empty string to represent undefined for now until
// we support a richer format for overrides and the block binding API.
Expand Down

0 comments on commit b667034

Please sign in to comment.