Make WordPress Core

Changeset 57575


Ignore:
Timestamp:
02/09/2024 10:52:09 AM (10 months ago)
Author:
gziolo
Message:

Editor: Add wakeup magic method to the block bindings registry

See #60282.
Follow-up [57373].
Props dmsnell, mukesh27, gziolo.

Location:
trunk/src/wp-includes
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/wp-includes/class-wp-block-bindings-registry.php

    r57562 r57575  
    213213
    214214    /**
     215     * Wakeup magic method.
     216     *
     217     * @since 6.5.0
     218     */
     219    public function __wakeup() {
     220        if ( ! $this->sources ) {
     221            return;
     222        }
     223        if ( ! is_array( $this->sources ) ) {
     224            throw new UnexpectedValueException();
     225        }
     226        foreach ( $this->sources as $value ) {
     227            if ( ! $value instanceof WP_Block_Bindings_Source ) {
     228                throw new UnexpectedValueException();
     229            }
     230        }
     231    }
     232
     233    /**
    215234     * Utility method to retrieve the main instance of the class.
    216235     *
  • trunk/src/wp-includes/class-wp-block.php

    r57574 r57575  
    414414        $computed_attributes = $this->process_block_bindings();
    415415        if ( ! empty( $computed_attributes ) ) {
    416             // Merge the computed attributes with the original attributes
     416            // Merge the computed attributes with the original attributes.
    417417            $this->attributes = array_merge( $this->attributes, $computed_attributes );
    418418        }
Note: See TracChangeset for help on using the changeset viewer.