Make WordPress Core

Changeset 48969


Ignore:
Timestamp:
09/10/2020 04:32:52 PM (4 years ago)
Author:
helen
Message:

REST API: Include attribute name in schema validation error message.

Props bobbingwide.
Fixes #51231.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/wp-includes/class-wp-block-type.php

    r48275 r48969  
    210210    public function prepare_attributes_for_render( $attributes ) {
    211211        // If there are no attribute definitions for the block type, skip
    212         // processing and return vebatim.
     212        // processing and return verbatim.
    213213        if ( ! isset( $this->attributes ) ) {
    214214            return $attributes;
     
    228228            // attributes loop immediately following. If there is not a default
    229229            // assigned, the attribute value should remain unset.
    230             $is_valid = rest_validate_value_from_schema( $value, $schema );
     230            $is_valid = rest_validate_value_from_schema( $value, $schema, $attribute_name );
    231231            if ( is_wp_error( $is_valid ) ) {
    232232                unset( $attributes[ $attribute_name ] );
Note: See TracChangeset for help on using the changeset viewer.