WP_Font_Collection::load_from_file()
Loads the font collection data from a JSON file path.
Метод класса: WP_Font_Collection{}
Хуков нет.
Возвращает
Массив|WP_Error
. An array containing the font collection data on success, else an instance of WP_Error on failure.
Использование
// private - только в коде основоного (родительского) класса $result = $this->load_from_file( $file );
- $file(строка) (обязательный)
- File path to a JSON file containing the font collection data.
Список изменений
С версии 6.5.0 | Введена. |
Код WP_Font_Collection::load_from_file() WP Font Collection::load from file WP 6.7.1
private function load_from_file( $file ) { $data = wp_json_file_decode( $file, array( 'associative' => true ) ); if ( empty( $data ) ) { return new WP_Error( 'font_collection_decode_error', __( 'Error decoding the font collection JSON file contents.' ) ); } return $this->sanitize_and_validate_data( $data, array( 'font_families' ) ); }