-
Notifications
You must be signed in to change notification settings - Fork 4.2k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
106 changed files
with
11,982 additions
and
1,528 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
https://github.com/WordPress/wordpress-develop/pull/7020 | ||
|
||
* https://github.com/WordPress/gutenberg/pull/63470 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
<?php | ||
/** | ||
* Temporary compatibility code for new functionalitites/changes related to block bindings APIs present in Gutenberg. | ||
* | ||
* @package gutenberg | ||
*/ | ||
|
||
/** | ||
* Adds the block bindings sources registered in the server to the editor settings. | ||
* | ||
* This allows them to be bootstrapped in the editor. | ||
* | ||
* @param array $settings The block editor settings from the `block_editor_settings_all` filter. | ||
* @return array The editor settings including the block bindings sources. | ||
*/ | ||
function gutenberg_add_server_block_bindings_sources_to_editor_settings( $editor_settings ) { | ||
// Check if the sources are already exposed in the editor settings. | ||
if ( isset( $editor_settings['blockBindingsSources'] ) ) { | ||
return $editor_settings; | ||
} | ||
|
||
$registered_block_bindings_sources = get_all_registered_block_bindings_sources(); | ||
if ( ! empty( $registered_block_bindings_sources ) ) { | ||
// Initialize array. | ||
$editor_settings['blockBindingsSources'] = array(); | ||
foreach ( $registered_block_bindings_sources as $source_name => $source_properties ) { | ||
// Add source with the label to editor settings. | ||
$editor_settings['blockBindingsSources'][ $source_name ] = array( | ||
'label' => $source_properties->label, | ||
); | ||
// Add `usesContext` property if exists. | ||
if ( ! empty( $source_properties->uses_context ) ) { | ||
$editor_settings['blockBindingsSources'][ $source_name ]['usesContext'] = $source_properties->uses_context; | ||
} | ||
} | ||
} | ||
return $editor_settings; | ||
} | ||
|
||
add_filter( 'block_editor_settings_all', 'gutenberg_add_server_block_bindings_sources_to_editor_settings', 10 ); |
Oops, something went wrong.