From b703b3bfcc183be689a869aba8fec1639a92feec Mon Sep 17 00:00:00 2001 From: Vlad Date: Wed, 10 Apr 2024 12:12:11 -0400 Subject: [PATCH] Add onboarding id dymanically [ci skip] --- future/includes/class-gv-onboarding.php | 14 ++++++++------ future/includes/class-gv-settings-plugin.php | 18 +++++++----------- 2 files changed, 15 insertions(+), 17 deletions(-) diff --git a/future/includes/class-gv-onboarding.php b/future/includes/class-gv-onboarding.php index 459c0f4b1..f314ad45d 100644 --- a/future/includes/class-gv-onboarding.php +++ b/future/includes/class-gv-onboarding.php @@ -11,6 +11,8 @@ class Onboarding { */ private $plugin = GRAVITYVIEW_FILE; + private $onboarding_id = 'create_view'; + /** * Onboarding constructor. */ @@ -29,7 +31,7 @@ public function handle_restart_product_tour() { return; } - $this->restart_onboarding(); + $this->restart_onboarding( $this->plugin, $this->onboarding_id ); $this->redirect_after_restart(); } @@ -50,9 +52,9 @@ private function should_restart_onboarding() { * * @return void */ - private function restart_onboarding() { - $onboarding = OnboardingFramework::get_instance( $this->plugin ); - $onboarding->restart_onboarding(); + private function restart_onboarding( $plugin, $onboarding_id ) { + $onboarding = OnboardingFramework::get_instance( $plugin ); + $onboarding->restart_onboarding( $onboarding_id ); } /** @@ -247,7 +249,7 @@ public function init() { ] ); // Initialise onboarding. - $onboarding = OnboardingFramework::get_instance( $this->plugin ); + $onboarding = OnboardingFramework::get_instance( $this->plugin); $onboarding->steps->add( $step_1 ) ->add( $step_2 ) @@ -261,7 +263,7 @@ public function init() { ->add( $step_10 ) ->add( $step_11 ); - $onboarding->init_onboarding(); + $onboarding->init_onboarding( $this->onboarding_id ); } } diff --git a/future/includes/class-gv-settings-plugin.php b/future/includes/class-gv-settings-plugin.php index 1e51ff23d..b7c0916d8 100644 --- a/future/includes/class-gv-settings-plugin.php +++ b/future/includes/class-gv-settings-plugin.php @@ -369,17 +369,13 @@ public function add_settings( $plugins_data ) { 'title' => esc_html__( 'Product Tour', 'gk-gravityview' ), 'settings' => [ [ - 'id' => 'restart_product_tour', - 'type' => 'button', - 'title' => esc_html__( 'Restart Product Tour', 'gk-gravityview' ), - 'description' => strtr( - // translators: Do not translate the words inside the {} curly brackets; they are replaced. - __( 'Restart GravityView product tour by clicking on this {link}link{/link}', 'gk-gravityview' ), - array( - '{link}' => $product_tour_link, - '{/link}' => ' ' . esc_html__( '(This link opens in a new window.)', 'gk-gravityview' ) . '', - ) - ), + 'id' => 'restart_product_tour', + 'type' => 'button', + 'title' => esc_html__( 'Restart Product Tour', 'gk-gravityview' ), + 'url' => $link, + 'btnText' => __( 'Restart', 'gk-gravityview' ), + 'screenReaderText' => esc_html__( 'This link opens in a new window', 'gk-gravityview' ), + 'description' => esc_html__( 'Restart the GravityView product tour by clicking the button.', 'gk-gravityview' ), ], ], ],