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

Block Bindings: Prepare the ground to define fieldsList on the server. #7987

Open
wants to merge 5 commits into
base: trunk
Choose a base branch
from
Open
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
1 change: 1 addition & 0 deletions src/wp-admin/edit-form-blocks.php
Original file line number Diff line number Diff line change
Expand Up @@ -119,6 +119,7 @@ static function ( $classes ) {
'name' => $source->name,
'label' => $source->label,
'usesContext' => $source->uses_context,
'args' => $source->args,
);
}
$script = sprintf( 'for ( const source of %s ) { wp.blocks.registerBlockBindingsSource( source ); }', wp_json_encode( $filtered_sources ) );
Expand Down
1 change: 1 addition & 0 deletions src/wp-admin/site-editor.php
Original file line number Diff line number Diff line change
Expand Up @@ -145,6 +145,7 @@ static function ( $classes ) {
'name' => $source->name,
'label' => $source->label,
'usesContext' => $source->uses_context,
'args' => $source->args,
);
}
$script = sprintf( 'for ( const source of %s ) { wp.blocks.registerBlockBindingsSource( source ); }', wp_json_encode( $filtered_sources ) );
Expand Down
1 change: 1 addition & 0 deletions src/wp-admin/widgets-form-blocks.php
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,7 @@
'name' => $source->name,
'label' => $source->label,
'usesContext' => $source->uses_context,
'args' => $source->args,
);
}
$script = sprintf( 'for ( const source of %s ) { wp.blocks.registerBlockBindingsSource( source ); }', wp_json_encode( $filtered_sources ) );
Expand Down
1 change: 1 addition & 0 deletions src/wp-includes/class-wp-block-bindings-registry.php
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,7 @@ final class WP_Block_Bindings_Registry {
'label',
'get_value_callback',
'uses_context',
'args',
);

/**
Expand Down
8 changes: 8 additions & 0 deletions src/wp-includes/class-wp-block-bindings-source.php
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,14 @@ final class WP_Block_Bindings_Source {
*/
private $get_value_callback;

/**
* Provide fields that will be shown in the Block Bindings UI.
*
* @since 6.8.0
* @var array
*/
public $args;

/**
* The context added to the blocks needed by the source.
*
Expand Down
1 change: 1 addition & 0 deletions src/wp-includes/class-wp-customize-widgets.php
Original file line number Diff line number Diff line change
Expand Up @@ -875,6 +875,7 @@ public function enqueue_scripts() {
'name' => $source->name,
'label' => $source->label,
'usesContext' => $source->uses_context,
'args' => $source->args,
);
}
$script = sprintf( 'for ( const source of %s ) { wp.blocks.registerBlockBindingsSource( source ); }', wp_json_encode( $filtered_sources ) );
Expand Down
Loading