rest_find_matching_pattern_property_schema()
Finds the schema for a property using the patternProperties keyword.
Хуков нет.
Возвращает
Массив|null. The schema of matching pattern property, or null if no patterns match.
Использование
rest_find_matching_pattern_property_schema( $property, $args );
- $property(строка) (обязательный)
- The property name to check.
- $args(массив) (обязательный)
- The schema array to use.
Список изменений
| С версии 5.6.0 | Введена. |
Код rest_find_matching_pattern_property_schema() rest find matching pattern property schema WP 7.0.4
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;
}