mirror of
https://github.com/WordPress/WordPress.git
synced 2025-01-03 06:57:35 +01:00
Editor: Add wakeup magic method to the block bindings registry
See #60282. Follow-up [57373]. Props dmsnell, mukesh27, gziolo. Built from https://develop.svn.wordpress.org/trunk@57575 git-svn-id: http://core.svn.wordpress.org/trunk@57076 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
parent
9cd17860ba
commit
66badc5b0d
@ -211,6 +211,25 @@ final class WP_Block_Bindings_Registry {
|
|||||||
return isset( $this->sources[ $source_name ] );
|
return isset( $this->sources[ $source_name ] );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Wakeup magic method.
|
||||||
|
*
|
||||||
|
* @since 6.5.0
|
||||||
|
*/
|
||||||
|
public function __wakeup() {
|
||||||
|
if ( ! $this->sources ) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
if ( ! is_array( $this->sources ) ) {
|
||||||
|
throw new UnexpectedValueException();
|
||||||
|
}
|
||||||
|
foreach ( $this->sources as $value ) {
|
||||||
|
if ( ! $value instanceof WP_Block_Bindings_Source ) {
|
||||||
|
throw new UnexpectedValueException();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Utility method to retrieve the main instance of the class.
|
* Utility method to retrieve the main instance of the class.
|
||||||
*
|
*
|
||||||
|
@ -413,7 +413,7 @@ class WP_Block {
|
|||||||
// Process the block bindings and get attributes updated with the values from the sources.
|
// Process the block bindings and get attributes updated with the values from the sources.
|
||||||
$computed_attributes = $this->process_block_bindings();
|
$computed_attributes = $this->process_block_bindings();
|
||||||
if ( ! empty( $computed_attributes ) ) {
|
if ( ! empty( $computed_attributes ) ) {
|
||||||
// Merge the computed attributes with the original attributes
|
// Merge the computed attributes with the original attributes.
|
||||||
$this->attributes = array_merge( $this->attributes, $computed_attributes );
|
$this->attributes = array_merge( $this->attributes, $computed_attributes );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -16,7 +16,7 @@
|
|||||||
*
|
*
|
||||||
* @global string $wp_version
|
* @global string $wp_version
|
||||||
*/
|
*/
|
||||||
$wp_version = '6.5-alpha-57574';
|
$wp_version = '6.5-alpha-57575';
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema.
|
* Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema.
|
||||||
|
Loading…
Reference in New Issue
Block a user