- Timestamp:
- 12/13/2018 09:53:10 AM (6 years ago)
- Location:
- trunk
- Files:
-
- 2 edited
- 2 copied
Legend:
- Unmodified
- Added
- Removed
-
trunk
- Property svn:mergeinfo changed
/branches/5.0 merged: 43743
- Property svn:mergeinfo changed
-
trunk/src/wp-includes/blocks.php
r44108 r44109 7 7 * @since 5.0.0 8 8 */ 9 10 /** 11 * Registers a block type. 12 * 13 * @since 5.0.0 14 * 15 * @param string|WP_Block_Type $name Block type name including namespace, or alternatively a 16 * complete WP_Block_Type instance. In case a WP_Block_Type 17 * is provided, the $args parameter will be ignored. 18 * @param array $args { 19 * Optional. Array of block type arguments. Any arguments may be defined, however the 20 * ones described below are supported by default. Default empty array. 21 * 22 * @type callable $render_callback Callback used to render blocks of this block type. 23 * } 24 * @return WP_Block_Type|false The registered block type on success, or false on failure. 25 */ 26 function register_block_type( $name, $args = array() ) { 27 return WP_Block_Type_Registry::get_instance()->register( $name, $args ); 28 } 29 30 /** 31 * Unregisters a block type. 32 * 33 * @since 5.0.0 34 * 35 * @param string|WP_Block_Type $name Block type name including namespace, or alternatively a 36 * complete WP_Block_Type instance. 37 * @return WP_Block_Type|false The unregistered block type on success, or false on failure. 38 */ 39 function unregister_block_type( $name ) { 40 return WP_Block_Type_Registry::get_instance()->unregister( $name ); 41 } 9 42 10 43 /** … … 60 93 return false !== strpos( $post, '<!-- wp:' . $block_type . ' ' ); 61 94 } 95 96 /** 97 * Returns an array of the names of all registered dynamic block types. 98 * 99 * @since 5.0.0 100 * 101 * @return array Array of dynamic block names. 102 */ 103 function get_dynamic_block_names() { 104 $dynamic_block_names = array(); 105 106 $block_types = WP_Block_Type_Registry::get_instance()->get_all_registered(); 107 foreach ( $block_types as $block_type ) { 108 if ( $block_type->is_dynamic() ) { 109 $dynamic_block_names[] = $block_type->name; 110 } 111 } 112 113 return $dynamic_block_names; 114 }
Note: See TracChangeset
for help on using the changeset viewer.