diff --git a/admin/class-convertkit-admin-setup-wizard.php b/admin/class-convertkit-admin-setup-wizard.php index 92cf0cf83..98c86e97b 100644 --- a/admin/class-convertkit-admin-setup-wizard.php +++ b/admin/class-convertkit-admin-setup-wizard.php @@ -169,6 +169,16 @@ public function maybe_load_setup_screen() { $this->is_modal = true; } + /** + * Define the steps for the setup wizard. + * + * @since 3.1.8 + * + * @param array $steps The steps for the setup wizard. + * @return array The steps for the setup wizard. + */ + $this->steps = apply_filters( 'convertkit_admin_setup_wizard_steps_' . $this->page_name, $this->steps ); + // Define the step the user is on in the setup process. $this->step = $this->get_current_step(); diff --git a/admin/setup-wizard/class-convertkit-admin-setup-wizard-landing-page.php b/admin/setup-wizard/class-convertkit-admin-setup-wizard-landing-page.php index f2db0c670..bb053c7ea 100644 --- a/admin/setup-wizard/class-convertkit-admin-setup-wizard-landing-page.php +++ b/admin/setup-wizard/class-convertkit-admin-setup-wizard-landing-page.php @@ -84,8 +84,28 @@ class ConvertKit_Admin_Setup_Wizard_Landing_Page extends ConvertKit_Admin_Setup_ */ public function __construct() { - // Define details for each step in the setup process. - $this->steps = array( + // Define the steps for the setup wizard. + add_filter( 'convertkit_admin_setup_wizard_steps_convertkit-landing-page-setup', array( $this, 'define_steps' ) ); + + add_action( 'convertkit_admin_setup_wizard_process_form_convertkit-landing-page-setup', array( $this, 'process_form' ) ); + add_action( 'convertkit_admin_setup_wizard_load_screen_data_convertkit-landing-page-setup', array( $this, 'load_screen_data' ) ); + + // Call parent class constructor. + parent::__construct(); + + } + + /** + * Define the steps for the setup wizard. + * + * @since 3.1.8 + * + * @param array $steps The steps for the setup wizard. + * @return array + */ + public function define_steps( $steps ) { + + return array( 'start' => array( 'name' => __( 'Setup', 'convertkit' ), 'next_button' => array( @@ -97,12 +117,6 @@ public function __construct() { ), ); - add_action( 'convertkit_admin_setup_wizard_process_form_convertkit-landing-page-setup', array( $this, 'process_form' ) ); - add_action( 'convertkit_admin_setup_wizard_load_screen_data_convertkit-landing-page-setup', array( $this, 'load_screen_data' ) ); - - // Call parent class constructor. - parent::__construct(); - } /** diff --git a/admin/setup-wizard/class-convertkit-admin-setup-wizard-plugin.php b/admin/setup-wizard/class-convertkit-admin-setup-wizard-plugin.php index a1277836b..2b9b935d9 100644 --- a/admin/setup-wizard/class-convertkit-admin-setup-wizard-plugin.php +++ b/admin/setup-wizard/class-convertkit-admin-setup-wizard-plugin.php @@ -92,15 +92,6 @@ class ConvertKit_Admin_Setup_Wizard_Plugin extends ConvertKit_Admin_Setup_Wizard */ public $exit_url = 'options-general.php?page=_wp_convertkit_settings'; - /** - * If the Form Importer step will be displayed. - * - * @since 3.1.7 - * - * @var bool - */ - public $show_form_importer_step = false; - /** * Holds the form importers. * @@ -121,10 +112,35 @@ public function __construct() { $this->api = new ConvertKit_API_V4( CONVERTKIT_OAUTH_CLIENT_ID, CONVERTKIT_OAUTH_CLIENT_REDIRECT_URI, false, false, false, 'setup_wizard' ); $this->settings = new ConvertKit_Settings(); - $this->show_form_importer_step = count( convertkit_get_form_importers() ) > 0 ? true : false; + // Define the steps for the setup wizard. + add_filter( 'convertkit_admin_setup_wizard_steps_convertkit-setup', array( $this, 'define_steps' ) ); + + // Register link to Setup Wizard below Plugin Name at Plugins > Installed Plugins. + add_filter( 'convertkit_plugin_screen_action_links', array( $this, 'add_setup_wizard_link_on_plugins_screen' ) ); + + add_action( 'admin_init', array( $this, 'maybe_redirect_to_setup_screen' ), 9999 ); + add_action( 'convertkit_admin_setup_wizard_process_form_convertkit-setup', array( $this, 'process_form' ) ); + add_action( 'convertkit_admin_setup_wizard_load_screen_data_convertkit-setup', array( $this, 'load_screen_data' ) ); + + // Call parent class constructor. + parent::__construct(); + + } + + /** + * Define the steps for the setup wizard. + * + * @since 3.1.8 + * + * @param array $steps The steps for the setup wizard. + * @return array + */ + public function define_steps( $steps ) { + + $show_form_importer_step = count( convertkit_get_form_importers() ) > 0 ? true : false; // Define details for each step in the setup process. - $this->steps = array( + $steps = array( 'start' => array( 'name' => __( 'Connect', 'convertkit' ), 'next_button' => array( @@ -135,14 +151,14 @@ public function __construct() { 'configuration' => array( 'name' => __( 'Configuration', 'convertkit' ), 'next_button' => array( - 'label' => $this->show_form_importer_step ? __( 'Next', 'convertkit' ) : __( 'Finish Setup', 'convertkit' ), + 'label' => $show_form_importer_step ? __( 'Next', 'convertkit' ) : __( 'Finish Setup', 'convertkit' ), ), ), ); // If the Form Importer step will be displayed, add it to the steps. - if ( $this->show_form_importer_step ) { - $this->steps['form-importer'] = array( + if ( $show_form_importer_step ) { + $steps['form-importer'] = array( 'name' => __( 'Form Importer', 'convertkit' ), 'next_button' => array( 'label' => __( 'Finish Setup', 'convertkit' ), @@ -151,19 +167,11 @@ public function __construct() { } // Add the finish step. - $this->steps['finish'] = array( + $steps['finish'] = array( 'name' => __( 'Done', 'convertkit' ), ); - // Register link to Setup Wizard below Plugin Name at Plugins > Installed Plugins. - add_filter( 'convertkit_plugin_screen_action_links', array( $this, 'add_setup_wizard_link_on_plugins_screen' ) ); - - add_action( 'admin_init', array( $this, 'maybe_redirect_to_setup_screen' ), 9999 ); - add_action( 'convertkit_admin_setup_wizard_process_form_convertkit-setup', array( $this, 'process_form' ) ); - add_action( 'convertkit_admin_setup_wizard_load_screen_data_convertkit-setup', array( $this, 'load_screen_data' ) ); - - // Call parent class constructor. - parent::__construct(); + return $steps; } diff --git a/admin/setup-wizard/class-convertkit-admin-setup-wizard-restrict-content.php b/admin/setup-wizard/class-convertkit-admin-setup-wizard-restrict-content.php index 001f77e9a..bf68d0a2c 100644 --- a/admin/setup-wizard/class-convertkit-admin-setup-wizard-restrict-content.php +++ b/admin/setup-wizard/class-convertkit-admin-setup-wizard-restrict-content.php @@ -138,8 +138,28 @@ class ConvertKit_Admin_Setup_Wizard_Restrict_Content extends ConvertKit_Admin_Se */ public function __construct() { - // Define details for each step in the setup process. - $this->steps = array( + // Define the steps for the setup wizard. + add_filter( 'convertkit_admin_setup_wizard_steps_convertkit-restrict-content-setup', array( $this, 'define_steps' ) ); + + add_action( 'convertkit_admin_setup_wizard_process_form_convertkit-restrict-content-setup', array( $this, 'process_form' ) ); + add_action( 'convertkit_admin_setup_wizard_load_screen_data_convertkit-restrict-content-setup', array( $this, 'load_screen_data' ) ); + + // Call parent class constructor. + parent::__construct(); + + } + + /** + * Define the steps for the setup wizard. + * + * @since 3.1.8 + * + * @param array $steps The steps for the setup wizard. + * @return array + */ + public function define_steps( $steps ) { + + return array( 'start' => array( 'name' => __( 'Setup', 'convertkit' ), ), @@ -154,12 +174,6 @@ public function __construct() { ), ); - add_action( 'convertkit_admin_setup_wizard_process_form_convertkit-restrict-content-setup', array( $this, 'process_form' ) ); - add_action( 'convertkit_admin_setup_wizard_load_screen_data_convertkit-restrict-content-setup', array( $this, 'load_screen_data' ) ); - - // Call parent class constructor. - parent::__construct(); - } /**