Skip to content

Commit

Permalink
Fix pattern bindings missing in WordPress 6.7 (#193)
Browse files Browse the repository at this point in the history
* Register a block bindings source to fix missing pattern values error
* Bump minimum supported WP version to 6.7
* Add eslint ignores for type issues related to registerBlockBindingsSource
  • Loading branch information
alecgeatches authored Nov 13, 2024
1 parent bec543b commit a6931f9
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 2 deletions.
2 changes: 1 addition & 1 deletion remote-data-blocks.php
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
* Author URI: https://wpvip.com
* Text Domain: remote-data-blocks
* Version: 0.2.7
* Requires at least: 6.6
* Requires at least: 6.7
* Requires PHP: 8.1
*/

Expand Down
14 changes: 13 additions & 1 deletion src/blocks/remote-data-container/index.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import { registerBlockType } from '@wordpress/blocks';
// @ts-expect-error -- Temporary registerBlockBindingsSource type error workaround for WordPress 6.7
import { registerBlockType, registerBlockBindingsSource } from '@wordpress/blocks';
import { addFilter } from '@wordpress/hooks';
import { registerFormatType } from '@wordpress/rich-text';

Expand Down Expand Up @@ -45,3 +46,14 @@ addFilter(
withBlockBindingShim,
5 // Ensure this runs before core filters
);

// eslint-disable-next-line -- Temporary registerBlockBindingsSource type error workaround for WordPress 6.7
registerBlockBindingsSource( {
name: 'remote-data/binding',
label: 'Remote Data Binding',
usesContext: [ 'remote-data-blocks/remoteData' ],
// eslint-disable-next-line -- Temporary registerBlockBindingsSource type error workaround for WordPress 6.7
getValues( { select, clientId, context, bindings }: any ) {
return {};
},
} );

0 comments on commit a6931f9

Please sign in to comment.