Automattic\WooCommerce\Admin\Features\Blueprint

RestApi::steps_payload_to_blueprint_steps()privateWC 1.0

Convert step list from the frontend to the backend format.

From: { "settings": ["setWCSettings", "setWCShippingZones", "setWCShippingMethods", "setWCShippingRates"], "plugins": ["akismet/akismet.php], "themes": ["approach], }

To:

["setWCSettings", "setWCShippingZones", "setWCShippingMethods", "setWCShippingRates", "installPlugin", "installTheme"]

Method of the class: RestApi{}

No Hooks.

Return

Array.

Usage

// private - for code of main (parent) class only
$result = $this->steps_payload_to_blueprint_steps( $steps );
$steps(array) (required)
steps payload from the frontend.

RestApi::steps_payload_to_blueprint_steps() code WC 9.7.1

private function steps_payload_to_blueprint_steps( $steps ) {
	$blueprint_steps = array();

	if ( isset( $steps['settings'] ) ) {
		$blueprint_steps = array_merge( $blueprint_steps, $steps['settings'] );
	}

	if ( isset( $steps['plugins'] ) ) {
		$blueprint_steps[] = 'installPlugin';
	}

	if ( isset( $steps['themes'] ) ) {
		$blueprint_steps[] = 'installTheme';
	}

	return $blueprint_steps;
}