| 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\Setup_Wizard as Wizard; |
| 6 |
use Barn2\Plugin\Posts_Table_Search_Sort\Dependencies\Lib\Plugin\Plugin; |
| 7 |
use Barn2\Plugin\Posts_Table_Search_Sort\Dependencies\Lib\Registerable; |
| 8 |
use Barn2\Plugin\Posts_Table_Search_Sort\Dependencies\Lib\Service\Standard_Service; |
| 9 |
|
| 10 |
/** |
| 11 |
* Setup wizard service. |
| 12 |
* |
| 13 |
* @package Barn2\posts-data-table |
| 14 |
* @author Barn2 Plugins <info@barn2.com> |
| 15 |
* @license GPL-3.0 |
| 16 |
* @copyright Barn2 Media Ltd |
| 17 |
*/ |
| 18 |
class Setup_Wizard implements Registerable, Standard_Service { |
| 19 |
|
| 20 |
/** |
| 21 |
* Plugin instance |
| 22 |
* |
| 23 |
* @var Plugin |
| 24 |
*/ |
| 25 |
private $plugin; |
| 26 |
|
| 27 |
/** |
| 28 |
* Wizard instance |
| 29 |
* |
| 30 |
* @var Wizard |
| 31 |
*/ |
| 32 |
private $wizard; |
| 33 |
|
| 34 |
/** |
| 35 |
* Get things started. |
| 36 |
* |
| 37 |
* @param Plugin $plugin |
| 38 |
*/ |
| 39 |
public function __construct( Plugin $plugin ) { |
| 40 |
$this->plugin = $plugin; |
| 41 |
$steps = [ |
| 42 |
new Steps\Welcome(), |
| 43 |
new Steps\Layout(), |
| 44 |
new Steps\Loading(), |
| 45 |
new Steps\Search(), |
| 46 |
new Steps\Upsell(), |
| 47 |
new Steps\Completed(), |
| 48 |
]; |
| 49 |
|
| 50 |
$wizard = new Wizard( $this->plugin, $steps ); |
| 51 |
|
| 52 |
$wizard->configure( |
| 53 |
[ |
| 54 |
'skip_url' => admin_url( 'options-general.php?page=posts_table_search_sort' ), |
| 55 |
'plugin_slug' => 'posts-table-with-search-and-sort', |
| 56 |
] |
| 57 |
); |
| 58 |
|
| 59 |
$wizard->add_restart_link( '', '' ); |
| 60 |
|
| 61 |
$this->wizard = $wizard; |
| 62 |
} |
| 63 |
|
| 64 |
/** |
| 65 |
* {@inheritdoc} |
| 66 |
*/ |
| 67 |
public function register() { |
| 68 |
$this->wizard->boot(); |
| 69 |
} |
| 70 |
} |
| 71 |
|