WP_REST_Font_Collections_Controller::get_item()
Gets a font collection.
Метод класса: WP_REST_Font_Collections_Controller{}
Хуков нет.
Возвращает
WP_REST_Response|WP_Error
. Response object on success, or WP_Error object on failure.
Использование
$WP_REST_Font_Collections_Controller = new WP_REST_Font_Collections_Controller(); $WP_REST_Font_Collections_Controller->get_item( $request );
- $request(WP_REST_Request) (обязательный)
- Full details about the request.
Список изменений
С версии 6.5.0 | Введена. |
Код WP_REST_Font_Collections_Controller::get_item() WP REST Font Collections Controller::get item WP 6.7.1
public function get_item( $request ) { $slug = $request->get_param( 'slug' ); $collection = WP_Font_Library::get_instance()->get_font_collection( $slug ); if ( ! $collection ) { return new WP_Error( 'rest_font_collection_not_found', __( 'Font collection not found.' ), array( 'status' => 404 ) ); } return $this->prepare_item_for_response( $collection, $request ); }