WP_REST_View_Config_Controller::get_items
Returns the default view configuration for the given entity type.
Метод класса: WP_REST_View_Config_Controller{}
Хуков нет.
Возвращает
WP_REST_Response|WP_Error. Response object on success, or WP_Error object on failure.
Использование
$WP_REST_View_Config_Controller = new WP_REST_View_Config_Controller(); $WP_REST_View_Config_Controller->get_items( $request );
- $request(WP_REST_Request) (обязательный)
- Full details about the request.
Список изменений
| С версии 7.1.0 | Введена. |
Код WP_REST_View_Config_Controller::get_items() WP REST View Config Controller::get items WP 7.1.2
public function get_items( $request ) {
$kind = $request->get_param( 'kind' );
$name = $request->get_param( 'name' );
$config = wp_get_entity_view_config( $kind, $name );
$schema = $this->get_item_schema();
$response = array(
'kind' => $kind,
'name' => $name,
'version' => WP_View_Config_Data::LATEST_VERSION,
'default_view' => $this->cast_empty_objects( $config['default_view'], $schema['properties']['default_view'] ),
'default_layouts' => $this->cast_empty_objects( $config['default_layouts'], $schema['properties']['default_layouts'] ),
'view_list' => $this->cast_empty_objects( $config['view_list'], $schema['properties']['view_list'] ),
'form' => $this->cast_empty_objects( $config['form'], $schema['properties']['form'] ),
);
return rest_ensure_response( $response );
}