Skip to content

Commit

Permalink
Add comments
Browse files Browse the repository at this point in the history
  • Loading branch information
cbravobernal committed Oct 29, 2024
1 parent 0e951d0 commit 2a6bf13
Showing 1 changed file with 2 additions and 3 deletions.
5 changes: 2 additions & 3 deletions docs/reference-guides/block-api/block-bindings.md
Original file line number Diff line number Diff line change
Expand Up @@ -149,7 +149,6 @@ The function to register a custom source is `registerBlockBindingsSource( args )

The `label` argument will override the one defined on the server if they are different.


This example will show a custom post meta date in the editor and, if it doesn't exist, it will show today's date. The user can edit the value of the date. (Caution: This example does not format the user input as a date—it's only for educational purposes.)

```js
Expand All @@ -161,8 +160,8 @@ import { store as coreDataStore } from '@wordpress/core-data';

registerBlockBindingsSource( {
name: 'wpmovies/visualization-date',
label: __( 'Visualization Date', 'custom-bindings' ),
usesContext: [ 'postId', 'postType' ],
label: __( 'Visualization Date', 'custom-bindings' ), // We can skip the label, as it was already defined in the server in the previous example.
usesContext: [ 'postType' ], // We can skip postId, as it was already defined in the server in the previous example.
getValues( { select, context } ) {
let wpMoviesVisualizationDate;
const { getEditedEntityRecord } = select( coreDataStore );
Expand Down

0 comments on commit 2a6bf13

Please sign in to comment.