Changeset 43751 for branches/5.0/src/wp-includes/blocks.php
- Timestamp:
- 10/18/2018 04:39:40 AM (7 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/5.0/src/wp-includes/blocks.php
r43743 r43751 113 113 return $dynamic_block_names; 114 114 } 115 116 /** 117 * Parses blocks out of a content string. 118 * 119 * @since 5.0.0 120 * 121 * @param string $content Post content. 122 * @return array Array of parsed block objects. 123 */ 124 function parse_blocks( $content ) { 125 /* 126 * If there are no blocks in the content, return a single block, rather 127 * than wasting time trying to parse the string. 128 */ 129 if ( ! has_blocks( $content ) ) { 130 return array( 131 array( 132 'blockName' => null, 133 'attrs' => array(), 134 'innerBlocks' => array(), 135 'innerHTML' => $content, 136 ), 137 ); 138 } 139 140 /** 141 * Filter to allow plugins to replace the server-side block parser 142 * 143 * @since 5.0.0 144 * 145 * @param string $parser_class Name of block parser class 146 */ 147 $parser_class = apply_filters( 'block_parser_class', 'WP_Block_Parser' ); 148 149 $parser = new $parser_class(); 150 return $parser->parse( $content ); 151 }
Note: See TracChangeset
for help on using the changeset viewer.