Ticket #50550: 50550-doing-it-wrong.patch
File 50550-doing-it-wrong.patch, 1.4 KB (added by , 5 years ago) |
---|
-
src/wp-includes/class-wp-block-patterns-registry.php
33 33 * @since 5.5.0 34 34 * 35 35 * @param string $pattern_name Pattern name including namespace. 36 * @param array $pattern_properties Array containing the properties of the pattern: label, content.36 * @param array $pattern_properties Array containing the properties of the pattern: Title, content, description, viewportWidth, categories, keywords. 37 37 * @return bool True if the pattern was registered with success and false otherwise. 38 38 */ 39 39 public function register( $pattern_name, $pattern_properties ) { … … 42 42 return false; 43 43 } 44 44 45 if ( ! isset( $pattern_properties['title'] ) || ! is_string( $pattern_properties['title'] ) ) { 46 _doing_it_wrong( __METHOD__, __( 'Pattern title must be a string.' ), '5.5.0' ); 47 return false; 48 } 49 50 if ( ! isset( $pattern_properties['content'] ) || ! is_string( $pattern_properties['content'] ) ) { 51 _doing_it_wrong( __METHOD__, __( 'Pattern content must be a string.' ), '5.5.0' ); 52 return false; 53 } 54 45 55 $this->registered_patterns[ $pattern_name ] = array_merge( 46 56 $pattern_properties, 47 57 array( 'name' => $pattern_name )