| @@ -1,4 +1,4 @@ | ||
| 1 | 1 | <?php /** |
| 2 | 2 | * @version 1.0 |
| 3 | 3 | * @description Steps Structure for Setup Wizard Page |
| 4 | 4 | * @category Setup Class |
| @@ -41,12 +41,31 @@ | ||
| 41 | 41 | * Whether the setup bar has already been printed in the current request. |
| 42 | 42 | * |
| 43 | 43 | * @var bool |
| 44 | 44 | */ |
| 45 | - private static $is_top_bar_rendered = false; | |
| 45 | + private static $is_top_bar_rendered = false; | |
| 46 | + | |
| 47 | + /** | |
| 48 | + * Check whether the legacy floating Setup Wizard bar is enabled. | |
| 49 | + * | |
| 50 | + * The bar is temporarily disabled while the initial Setup Wizard hands the | |
| 51 | + * user directly to Form Builder. The filter preserves a bounded rollback | |
| 52 | + * path without changing Setup Wizard progress or stored configuration. | |
| 53 | + * | |
| 54 | + * @return bool True when the floating Setup Wizard bar may be registered. | |
| 55 | + */ | |
| 56 | + private static function is_floating_setup_bar_enabled() { | |
| 57 | + | |
| 58 | + /** | |
| 59 | + * Filter whether the legacy floating Setup Wizard bar is enabled. | |
| 60 | + * | |
| 61 | + * @param bool $is_enabled Whether the floating Setup Wizard bar is enabled. | |
| 62 | + */ | |
| 63 | + return (bool) apply_filters( 'wpbc_setup_wizard_floating_bar_enabled', false ); | |
| 64 | + } | |
| 65 | + | |
| 66 | + public function __construct() { | |
| 46 | 67 | |
| 47 | - public function __construct() { | |
| 48 | - | |
| 49 | 68 | if ( WPBC()->is_wp_inited() || did_action( 'init' ) ) { |
| 50 | 69 | $this->init_steps_data(); |
| 51 | 70 | } else { |
| 52 | 71 | add_action( 'init', array( $this, 'init_steps_data' ) ); |
| @@ -51,12 +70,12 @@ | ||
| 51 | 70 | } else { |
| 52 | 71 | add_action( 'init', array( $this, 'init_steps_data' ) ); |
| 53 | 72 | } |
| 54 | 73 | |
| 55 | - if ( ! self::$is_top_bar_hook_registered ) { | |
| 56 | - add_action( 'wpbc_after_wpbc_page_top__header_tabs', array( $this, 'show_top_right_wizard_button' ), 10, 3 ); | |
| 57 | - self::$is_top_bar_hook_registered = true; | |
| 58 | - } | |
| 74 | + if ( self::is_floating_setup_bar_enabled() && ! self::$is_top_bar_hook_registered ) { | |
| 75 | + add_action( 'wpbc_after_wpbc_page_top__header_tabs', array( $this, 'show_top_right_wizard_button' ), 10, 3 ); | |
| 76 | + self::$is_top_bar_hook_registered = true; | |
| 77 | + } | |
| 59 | 78 | |
| 60 | 79 | } |
| 61 | 80 | |
| 62 | 81 | /** |
| @@ -812,11 +831,15 @@ | ||
| 812 | 831 | * |
| 813 | 832 | * Show Continue Setup Wizard Button |
| 814 | 833 | * @return void |
| 815 | 834 | */ |
| 816 | - public function show_top_right_wizard_button() { | |
| 817 | - | |
| 818 | - if ( ! wpbc_is_setup_wizard_page() ) { | |
| 835 | + public function show_top_right_wizard_button() { | |
| 836 | + | |
| 837 | + if ( ! self::is_floating_setup_bar_enabled() ) { | |
| 838 | + return false; | |
| 839 | + } | |
| 840 | + | |
| 841 | + if ( ! wpbc_is_setup_wizard_page() ) { | |
| 819 | 842 | $explicit_step_context = false; |
| 820 | 843 | |
| 821 | 844 | // phpcs:ignore WordPress.Security.NonceVerification.Recommended -- Read-only Setup Wizard routing context. |
| 822 | 845 | if ( isset( $_GET['wpbc_setup_step'] ) && is_scalar( $_GET['wpbc_setup_step'] ) ) { |