- Timestamp:
- 02/27/2024 09:03:54 PM (8 months ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/wp-includes/class-wp-block-patterns-registry.php
r57683 r57731 46 46 * @since 6.1.0 Added support for the `postTypes` property. 47 47 * @since 6.2.0 Added support for the `templateTypes` property. 48 * @since 6.5.0 Added support for the `filePath` property. 48 49 * 49 50 * @param string $pattern_name Block pattern name including namespace. … … 52 53 * 53 54 * @type string $title Required. A human-readable title for the pattern. 54 * @type string $content Required. Block HTML markup for the pattern. 55 * @type string $content Optional. Block HTML markup for the pattern. 56 * If not provided, the content will be retrieved from the `filePath` if set. 57 * If both `content` and `filePath` are not set, the pattern will not be registered. 55 58 * @type string $description Optional. Visually hidden text used to describe the pattern 56 59 * in the inserter. A description is optional, but is strongly … … 80 83 * not part of the array the pattern is not available at all. 81 84 * @type string[] $templateTypes Optional. An array of template types where the pattern fits. 85 * @type string $filePath Optional. The full path to the file containing the block pattern content. 82 86 * } 83 87 * @return bool True if the pattern was registered with success and false otherwise. … … 102 106 } 103 107 104 if ( ! isset( $pattern_properties['file _path'] ) ) {108 if ( ! isset( $pattern_properties['filePath'] ) ) { 105 109 if ( ! isset( $pattern_properties['content'] ) || ! is_string( $pattern_properties['content'] ) ) { 106 110 _doing_it_wrong( … … 195 199 $patterns = &$this->registered_patterns; 196 200 } 197 if ( ! isset( $patterns[ $pattern_name ]['content'] ) && isset( $patterns[ $pattern_name ]['file _path'] ) ) {201 if ( ! isset( $patterns[ $pattern_name ]['content'] ) && isset( $patterns[ $pattern_name ]['filePath'] ) ) { 198 202 ob_start(); 199 include $patterns[ $pattern_name ]['file _path'];203 include $patterns[ $pattern_name ]['filePath']; 200 204 $patterns[ $pattern_name ]['content'] = ob_get_clean(); 201 unset( $patterns[ $pattern_name ]['file _path'] );205 unset( $patterns[ $pattern_name ]['filePath'] ); 202 206 } 203 207 return $patterns[ $pattern_name ]['content'];
Note: See TracChangeset
for help on using the changeset viewer.