Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Remove unneeded pattern overrides translation strings #59269

Merged
merged 1 commit into from
Feb 22, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Remove unneeded pattern overrides translation strings
  • Loading branch information
kevin940726 committed Feb 22, 2024
commit bc84770f8b532240512b9f4368dcb78626a7e84c
6 changes: 3 additions & 3 deletions packages/patterns/src/components/partial-syncing-controls.js
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ import { PARTIAL_SYNCING_SUPPORTED_BLOCKS } from '../constants';

function PartialSyncingControls( { name, attributes, setAttributes } ) {
const syncedAttributes = PARTIAL_SYNCING_SUPPORTED_BLOCKS[ name ];
const attributeSources = Object.keys( syncedAttributes ).map(
const attributeSources = syncedAttributes.map(
( attributeName ) =>
attributes.metadata?.bindings?.[ attributeName ]?.source
);
Expand All @@ -36,7 +36,7 @@ function PartialSyncingControls( { name, attributes, setAttributes } ) {
};

if ( ! isChecked ) {
for ( const attributeName of Object.keys( syncedAttributes ) ) {
for ( const attributeName of syncedAttributes ) {
if (
updatedBindings[ attributeName ]?.source ===
'core/pattern-overrides'
Expand All @@ -56,7 +56,7 @@ function PartialSyncingControls( { name, attributes, setAttributes } ) {
return;
}

for ( const attributeName of Object.keys( syncedAttributes ) ) {
for ( const attributeName of syncedAttributes ) {
if ( ! updatedBindings[ attributeName ] ) {
updatedBindings[ attributeName ] = {
source: 'core/pattern-overrides',
Expand Down
23 changes: 4 additions & 19 deletions packages/patterns/src/constants.js
Original file line number Diff line number Diff line change
@@ -1,8 +1,3 @@
/**
* WordPress dependencies
*/
import { __ } from '@wordpress/i18n';

export const PATTERN_TYPES = {
theme: 'pattern',
user: 'wp_block',
Expand All @@ -22,18 +17,8 @@ export const PATTERN_SYNC_TYPES = {

// TODO: This should not be hardcoded. Maybe there should be a config and/or an UI.
export const PARTIAL_SYNCING_SUPPORTED_BLOCKS = {
'core/paragraph': { content: __( 'Content' ) },
'core/heading': { content: __( 'Content' ) },
'core/button': {
text: __( 'Text' ),
url: __( 'URL' ),
linkTarget: __( 'Link Target' ),
rel: __( 'Link Relationship' ),
},
'core/image': {
id: __( 'Image ID' ),
url: __( 'URL' ),
title: __( 'Title' ),
alt: __( 'Alt Text' ),
},
'core/paragraph': [ 'content' ],
'core/heading': [ 'content' ],
'core/button': [ 'text', 'url', 'linkTarget', 'rel' ],
'core/image': [ 'id', 'url', 'title', 'alt' ],
};
Loading