English (United Kingdom)

do_action( 'vikrestaurants_setup_wizard', Wizard $wizard )

Fires while initializing the wizard instance.


Description

Trigger hook on wizard setup, useful to preload all the needed resources. 


Parameters

$wizard

(Wizard)  The instance handling the wizard steps. This class is part of the E4J\VikRestaurants\Wizard namespace.


Example

The example below adds support for all the wizard steps contained in a specific folder of the plugin. Such as:

/wp-content/plugins/vikwp/wizard/

All the PHP files contained within the wizard folder of the VikWP plugin will be loaded.

/**
 * Trigger event on wizard setup, useful to preload all the needed resources.
 *
 * @param  Wizard  $wizard  The wizard instance.
 */
add_action('vikrestaurants_setup_wizard', function($wizard) {
    // create base path to "wizard" folder contained within the plugin
    $base = dirname(__FILE__) . DIRECTORY_SEPARATOR . 'wizard' . DIRECTORY_SEPARATOR;

    // register folder as wizard include path
    $wizard->addIncludePath($base);
});

Changelog

Version Description
1.3 The hook has been changed from a filter into an action as the plugin didn't need a return value anymore.
The $wizard argument is no more passed by reference.
1.1 Introduced.
Last Update: 2023-12-15
Helpful?
See Also: