| 1 |
<?php |
| 2 |
|
| 3 |
namespace Barn2\Plugin\Posts_Table_Search_Sort\Admin\Wizard; |
| 4 |
|
| 5 |
use Barn2\Plugin\Posts_Table_Search_Sort\Dependencies\Setup_Wizard\Starter as Setup_Wizard_Starter; |
| 6 |
|
| 7 |
/** |
| 8 |
* Setup Wizard Starter |
| 9 |
* |
| 10 |
* @package Barn2/posts-table-search-sort |
| 11 |
* @author Barn2 Plugins <info@barn2.com> |
| 12 |
* @license GPL-3.0 |
| 13 |
* @copyright Barn2 Media Ltd |
| 14 |
*/ |
| 15 |
class Starter extends Setup_Wizard_Starter { |
| 16 |
|
| 17 |
/** |
| 18 |
* Determine if the conditions to start the wizard are met. |
| 19 |
* |
| 20 |
* @return boolean |
| 21 |
*/ |
| 22 |
public function should_start() { |
| 23 |
$setup_happened = get_option( 'posts-table-search-sort-setup-wizard_completed' ) ?: false; |
| 24 |
return ! $setup_happened; |
| 25 |
} |
| 26 |
|
| 27 |
/** |
| 28 |
* Add an option so the setup wizard doesn't run after reactivating |
| 29 |
* |
| 30 |
* @return void |
| 31 |
*/ |
| 32 |
public function create_option() { |
| 33 |
update_option( "posts-table-search-sort-setup-wizard_completed", true ); |
| 34 |
} |
| 35 |
|
| 36 |
} |
| 37 |
|