Skip to content

Commit

Permalink
Add onboarding id dymanically [ci skip]
Browse files Browse the repository at this point in the history
  • Loading branch information
mrcasual committed Apr 10, 2024
1 parent 372000d commit b703b3b
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 17 deletions.
14 changes: 8 additions & 6 deletions future/includes/class-gv-onboarding.php
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,8 @@ class Onboarding {
*/
private $plugin = GRAVITYVIEW_FILE;

private $onboarding_id = 'create_view';

/**
* Onboarding constructor.
*/
Expand All @@ -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();
}
Expand All @@ -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 );
}

/**
Expand Down Expand Up @@ -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 )
Expand All @@ -261,7 +263,7 @@ public function init() {
->add( $step_10 )
->add( $step_11 );

$onboarding->init_onboarding();
$onboarding->init_onboarding( $this->onboarding_id );
}
}

Expand Down
18 changes: 7 additions & 11 deletions future/includes/class-gv-settings-plugin.php
Original file line number Diff line number Diff line change
Expand Up @@ -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}' => '<span class="screen-reader-text"> ' . esc_html__( '(This link opens in a new window.)', 'gk-gravityview' ) . '</span></a>',
)
),
'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' ),
],
],
],
Expand Down

0 comments on commit b703b3b

Please sign in to comment.