WP_Font_Collection::sanitize_and_validate_data()
Sanitizes and validates the font collection data.
Метод класса: WP_Font_Collection{}
Хуков нет.
Возвращает
Массив|WP_Error
. Sanitized data if valid, otherwise a WP_Error instance.
Использование
// private - только в коде основоного (родительского) класса $result = $this->sanitize_and_validate_data( $data, $required_properties );
- $data(массив) (обязательный)
- Font collection data to sanitize and validate.
- $required_properties(массив)
- Required properties that must exist in the passed data.
По умолчанию: array()
Список изменений
С версии 6.5.0 | Введена. |
Код WP_Font_Collection::sanitize_and_validate_data() WP Font Collection::sanitize and validate data WP 6.7.1
private function sanitize_and_validate_data( $data, $required_properties = array() ) { $schema = self::get_sanitization_schema(); $data = WP_Font_Utils::sanitize_from_schema( $data, $schema ); foreach ( $required_properties as $property ) { if ( empty( $data[ $property ] ) ) { $message = sprintf( // translators: 1: Font collection slug, 2: Missing property name, e.g. "font_families". __( 'Font collection "%1$s" has missing or empty property: "%2$s".' ), $this->slug, $property ); _doing_it_wrong( __METHOD__, $message, '6.5.0' ); return new WP_Error( 'font_collection_missing_property', $message ); } } return $data; }