Make WordPress Core


Ignore:
Timestamp:
02/08/2024 08:55:18 AM (3 months ago)
Author:
gziolo
Message:

Editor: Introduce WP_Block_Bindings_Source class

Abstracts the block bindings source array into a well-defined object.

Fixes #60447.
See #60282.
Follow-up [57373].
Props czapla, santosguillamot, gziolo.

File:
1 edited

Legend:

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

    r57561 r57562  
    271271            }
    272272
    273             $source_callback = $block_binding_source['get_value_callback'];
    274             $source_args     = ! empty( $block_binding['args'] ) && is_array( $block_binding['args'] ) ? $block_binding['args'] : array();
    275             $source_value    = call_user_func_array( $source_callback, array( $source_args, $this, $attribute_name ) );
     273            $source_args  = ! empty( $block_binding['args'] ) && is_array( $block_binding['args'] ) ? $block_binding['args'] : array();
     274            $source_value = $block_binding_source->get_value( $source_args, $this, $attribute_name );
    276275
    277276            // If the value is not null, process the HTML based on the block and the attribute.
Note: See TracChangeset for help on using the changeset viewer.