WC_REST_Setting_Options_V2_Controller::get_items()publicWC 3.0.0

Return all settings in a group.

Метод класса: WC_REST_Setting_Options_V2_Controller{}

Хуков нет.

Возвращает

WP_Error|WP_REST_Response.

Использование

$WC_REST_Setting_Options_V2_Controller = new WC_REST_Setting_Options_V2_Controller();
$WC_REST_Setting_Options_V2_Controller->get_items( $request );
$request(WP_REST_Request) (обязательный)
Request data.

Список изменений

С версии 3.0.0 Введена.

Код WC_REST_Setting_Options_V2_Controller::get_items() WC 9.3.3

public function get_items( $request ) {
	$settings = $this->get_group_settings( $request['group_id'] );

	if ( is_wp_error( $settings ) ) {
		return $settings;
	}

	$data = array();

	foreach ( $settings as $setting_obj ) {
		$setting = $this->prepare_item_for_response( $setting_obj, $request );
		$setting = $this->prepare_response_for_collection( $setting );
		if ( $this->is_setting_type_valid( $setting['type'] ) ) {
			$data[] = $setting;
		}
	}

	return rest_ensure_response( $data );
}