Changeset 60807
- Timestamp:
- 09/29/2025 08:57:51 AM (10 days ago)
- Location:
- trunk/src/wp-includes
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/wp-includes/block-bindings.php
r58395 r60807 130 130 return WP_Block_Bindings_Registry::get_instance()->get_registered( $source_name ); 131 131 } 132 133 /** 134 * Retrieves the list of block attributes supported by block bindings. 135 * 136 * @since 6.9.0 137 * 138 * @param string $block_type The block type whose supported attributes are being retrieved. 139 * @return array The list of block attributes that are supported by block bindings. 140 */ 141 function get_block_bindings_supported_attributes( $block_type ) { 142 $block_bindings_supported_attributes = array( 143 'core/paragraph' => array( 'content' ), 144 'core/heading' => array( 'content' ), 145 'core/image' => array( 'id', 'url', 'title', 'alt', 'caption' ), 146 'core/button' => array( 'url', 'text', 'linkTarget', 'rel' ), 147 'core/post-date' => array( 'datetime' ), 148 ); 149 150 $supported_block_attributes = 151 $block_bindings_supported_attributes[ $block_type ] ?? 152 array(); 153 154 /** 155 * Filters the supported block attributes for block bindings. 156 * 157 * @since 6.9.0 158 * 159 * @param string[] $supported_block_attributes The block's attributes that are supported by block bindings. 160 * @param string $block_type The block type whose attributes are being filtered. 161 */ 162 $supported_block_attributes = apply_filters( 163 'block_bindings_supported_attributes', 164 $supported_block_attributes, 165 $block_type 166 ); 167 168 /** 169 * Filters the supported block attributes for block bindings. 170 * 171 * The dynamic portion of the hook name, `$block_type`, refers to the block type 172 * whose attributes are being filtered. 173 * 174 * @since 6.9.0 175 * 176 * @param string[] $supported_block_attributes The block's attributes that are supported by block bindings. 177 */ 178 $supported_block_attributes = apply_filters( 179 "block_bindings_supported_attributes_{$block_type}", 180 $supported_block_attributes 181 ); 182 183 return $supported_block_attributes; 184 } -
trunk/src/wp-includes/block-editor.php
r60648 r60807 496 496 $custom_settings 497 497 ); 498 499 $editor_settings['__experimentalBlockBindingsSupportedAttributes'] = array(); 500 foreach ( array_keys( WP_Block_Type_Registry::get_instance()->get_all_registered() ) as $block_type ) { 501 $supported_block_attributes = get_block_bindings_supported_attributes( $block_type ); 502 if ( ! empty( $supported_block_attributes ) ) { 503 $editor_settings['__experimentalBlockBindingsSupportedAttributes'][ $block_type ] = $supported_block_attributes; 504 } 505 } 498 506 499 507 $global_styles = array(); -
trunk/src/wp-includes/class-wp-block.php
r60798 r60807 98 98 */ 99 99 public $inner_content = array(); 100 101 /**102 * List of supported block attributes for block bindings.103 *104 * @since 6.9.0105 * @var array106 *107 * @see WP_Block::process_block_bindings()108 */109 private const BLOCK_BINDINGS_SUPPORTED_ATTRIBUTES = array(110 'core/paragraph' => array( 'content' ),111 'core/heading' => array( 'content' ),112 'core/image' => array( 'id', 'url', 'title', 'alt', 'caption' ),113 'core/button' => array( 'url', 'text', 'linkTarget', 'rel' ),114 'core/post-date' => array( 'datetime' ),115 );116 100 117 101 /** … … 298 282 $parsed_block = $this->parsed_block; 299 283 $computed_attributes = array(); 300 $supported_block_attributes = 301 self::BLOCK_BINDINGS_SUPPORTED_ATTRIBUTES[ $block_type ] ?? 302 array(); 303 304 /** 305 * Filters the supported block attributes for block bindings. 306 * 307 * @since 6.9.0 308 * 309 * @param string[] $supported_block_attributes The block's attributes that are supported by block bindings. 310 * @param string $block_type The block type whose attributes are being filtered. 311 */ 312 $supported_block_attributes = apply_filters( 313 'block_bindings_supported_attributes', 314 $supported_block_attributes, 315 $block_type 316 ); 317 318 /** 319 * Filters the supported block attributes for block bindings. 320 * 321 * The dynamic portion of the hook name, `$block_type`, refers to the block type 322 * whose attributes are being filtered. 323 * 324 * @since 6.9.0 325 * 326 * @param string[] $supported_block_attributes The block's attributes that are supported by block bindings. 327 */ 328 $supported_block_attributes = apply_filters( 329 "block_bindings_supported_attributes_{$block_type}", 330 $supported_block_attributes 331 ); 284 $supported_block_attributes = get_block_bindings_supported_attributes( $block_type ); 332 285 333 286 // If the block doesn't have the bindings property, isn't one of the supported
Note: See TracChangeset for help on using the changeset viewer.