Automattic\WooCommerce\Admin\Features\Blueprint
RestApi::import_step()
Import a single step.
Метод класса: RestApi{}
Хуков нет.
Возвращает
Массив
.
Использование
$RestApi = new RestApi(); $RestApi->import_step( $request );
- $request(\WP_REST_Request) (обязательный)
- The request object.
Код RestApi::import_step() RestApi::import step WC 9.8.5
public function import_step( \WP_REST_Request $request ) { // Get the raw body size. $body_size = strlen( $request->get_body() ); if ( $body_size > $this->get_max_file_size() ) { return array( 'success' => false, 'messages' => array( array( 'message' => sprintf( // Translators: %s is the maximum file size in megabytes. __( 'Blueprint step definition size exceeds maximum limit of %s MB', 'woocommerce' ), ( $this->get_max_file_size() / ( 1024 * 1024 ) ) ), 'type' => 'error', ), ), ); } // Make sure we're dealing with object. $step_definition = json_decode( wp_json_encode( $request->get_param( 'step_definition' ) ) ); $step_importer = new ImportStep( $step_definition ); $result = $step_importer->import(); return array( 'success' => $result->is_success(), 'messages' => $result->get_messages(), ); }