Changeset 56610 for trunk/src/wp-includes/blocks.php
- Timestamp:
- 09/18/2023 12:40:11 PM (13 months ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/wp-includes/blocks.php
r56598 r56610 741 741 742 742 /** 743 * Retrieves block types (and positions) hooked into the given block. 744 * 745 * @since 6.4.0 746 * 747 * @param string $name Block type name including namespace. 748 * @return array Associative array of `$block_type_name => $position` pairs. 749 */ 750 function get_hooked_blocks( $name ) { 751 $block_types = WP_Block_Type_Registry::get_instance()->get_all_registered(); 752 $hooked_blocks = array(); 753 foreach ( $block_types as $block_type ) { 754 foreach ( $block_type->block_hooks as $anchor_block_type => $relative_position ) { 755 if ( $anchor_block_type === $name ) { 756 $hooked_blocks[ $block_type->name ] = $relative_position; 757 } 758 } 759 } 760 return $hooked_blocks; 761 } 762 763 /** 743 764 * Given an array of attributes, returns a string in the serialized attributes 744 765 * format prepared for post content.
Note: See TracChangeset
for help on using the changeset viewer.