Skip to content

Commit

Permalink
Don't use fallbacks
Browse files Browse the repository at this point in the history
  • Loading branch information
SantosGuillamot committed May 28, 2024
1 parent 01058e7 commit 4b83b29
Showing 1 changed file with 2 additions and 13 deletions.
15 changes: 2 additions & 13 deletions packages/editor/src/bindings/post-meta.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,28 +4,17 @@
import { store as coreDataStore } from '@wordpress/core-data';
import { _x } from '@wordpress/i18n';

/**
* Internal dependencies
*/
import { store as editorStore } from '../store';

export default {
name: 'core/post-meta',
label: _x( 'Post Meta', 'block bindings source' ),
usesContext: [ 'postId', 'postType' ],
getPlaceholder( { args } ) {
return args.key;
},
getValue( { select, context, args } ) {
const postId =
context?.postId || select( editorStore ).getCurrentPostId();
const postType =
context?.postType || select( editorStore ).getCurrentPostType();

return select( coreDataStore ).getEditedEntityRecord(
'postType',
postType,
postId
context?.postType,
context?.postId
).meta?.[ args.key ];
},
};

0 comments on commit 4b83b29

Please sign in to comment.