Automattic\WooCommerce\Admin\Features\Blueprint
RestApi::steps_payload_to_blueprint_steps
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.
Returns
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() RestApi::steps payload to blueprint steps code WC 10.5.0
private function steps_payload_to_blueprint_steps( $steps ) {
$blueprint_steps = array();
if ( isset( $steps['settings'] ) && count( $steps['settings'] ) > 0 ) {
$blueprint_steps = array_merge( $blueprint_steps, $steps['settings'] );
}
if ( isset( $steps['plugins'] ) && count( $steps['plugins'] ) > 0 ) {
$blueprint_steps[] = 'installPlugin';
}
if ( isset( $steps['themes'] ) && count( $steps['themes'] ) > 0 ) {
$blueprint_steps[] = 'installTheme';
}
return $blueprint_steps;
}