wpseek.com
WordPress开发者和主题制作者的搜索引擎



rest_find_matching_pattern_property_schema › WordPress Function

Since5.6.0
已弃用n/a
rest_find_matching_pattern_property_schema ( $property, $args )
参数: (2)
  • (string) $property The property name to check.
    Required: Yes
  • (array) $args The schema array to use.
    Required: Yes
返回:
  • (array|null) The schema of matching pattern property, or null if no patterns match.
定义在:
文档:

Finds the schema for a property using the patternProperties keyword.



源码

function rest_find_matching_pattern_property_schema( $property, $args ) {
	if ( isset( $args['patternProperties'] ) ) {
		foreach ( $args['patternProperties'] as $pattern => $child_schema ) {
			if ( rest_validate_json_schema_pattern( $pattern, $property ) ) {
				return $child_schema;
			}
		}
	}

	return null;
}