From 0b228c4fda62fd7cdc2464e2e9362dbe188f4829 Mon Sep 17 00:00:00 2001
From: Caleb Burks <19caleb95@gmail.com>
Date: Sat, 10 Feb 2018 18:28:07 -0500
Subject: [PATCH 1/5] Add ability to go back to prev steps during setup
---
assets/css/wc-setup.scss | 9 ++-
.../admin/class-wc-admin-setup-wizard.php | 78 +++++++++++++------
2 files changed, 64 insertions(+), 23 deletions(-)
diff --git a/assets/css/wc-setup.scss b/assets/css/wc-setup.scss
index 301bab4e0a4..79bfbef489f 100644
--- a/assets/css/wc-setup.scss
+++ b/assets/css/wc-setup.scss
@@ -334,6 +334,13 @@ body {
position: relative;
border-bottom: 4px solid #ccc;
line-height: 1.4em;
+ a {
+ color: inherit;
+ text-decoration: none;
+ &:hover, &:focus {
+ color: #111;
+ }
+ }
}
li::before {
content: '';
@@ -400,7 +407,7 @@ body {
margin-top: 0;
}
-.wc-return-to-dashboard {
+.wc-setup-footer-links {
font-size: 0.85em;
color: #b5b5b5;
margin: 1.18em 0;
diff --git a/includes/admin/class-wc-admin-setup-wizard.php b/includes/admin/class-wc-admin-setup-wizard.php
index 816cb4f2873..655b1e7247b 100644
--- a/includes/admin/class-wc-admin-setup-wizard.php
+++ b/includes/admin/class-wc-admin-setup-wizard.php
@@ -249,6 +249,33 @@ class WC_Admin_Setup_Wizard {
return add_query_arg( 'step', $keys[ $step_index + 1 ], remove_query_arg( 'activate_error' ) );
}
+ /**
+ * Get the URL for the last step's screen.
+ *
+ * @param string $step slug (default: current step).
+ * @return string URL for last step if a last step exists.
+ * Admin URL if it's the first step.
+ * Empty string on failure.
+ * @since 3.4.0
+ */
+ public function get_last_step_link( $step = '' ) {
+ if ( ! $step ) {
+ $step = $this->step;
+ }
+
+ $keys = array_keys( $this->steps );
+ if ( reset( $keys ) === $step ) {
+ return admin_url();
+ }
+
+ $step_index = array_search( $step, $keys );
+ if ( false === $step_index ) {
+ return '';
+ }
+
+ return add_query_arg( 'step', $keys[ $step_index - 1 ], remove_query_arg( 'activate_error' ) );
+ }
+
/**
* Setup Wizard Header.
*/
@@ -275,11 +302,11 @@ class WC_Admin_Setup_Wizard {
public function setup_wizard_footer() {
?>
step ) : ?>
-
- step ) : ?>
-
- step || 'extras' === $this->step ) : ?>
-
+
+ step ) : ?>
+
+
+