- Timestamp:
- 10/21/2019 07:08:34 PM (5 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/wp-includes/rest-api/fields/class-wp-rest-meta-fields.php
r46454 r46563 431 431 432 432 if ( null === $rest_args['schema']['default'] ) { 433 $rest_args['schema']['default'] = $this->get_default_for_type( $type );433 $rest_args['schema']['default'] = static::get_empty_value_for_type( $type ); 434 434 } 435 435 … … 502 502 } 503 503 504 if ( '' === $value && in_array( $schema['type'], array( 'boolean', 'integer', 'number' ), true ) ) { 505 $value = static::get_empty_value_for_type( $schema['type'] ); 506 } 507 504 508 if ( is_wp_error( rest_validate_value_from_schema( $value, $schema ) ) ) { 505 509 return null; … … 560 564 561 565 /** 562 * Gets the defaultvalue for a schema type.566 * Gets the empty value for a schema type. 563 567 * 564 568 * @since 5.3.0 … … 567 571 * @return mixed 568 572 */ 569 protected function get_default_for_type( $type ) {573 protected static function get_empty_value_for_type( $type ) { 570 574 switch ( $type ) { 571 575 case 'string':
Note: See TracChangeset
for help on using the changeset viewer.