Automattic\WooCommerce\Internal\ComingSoon
ComingSoonRequestHandler::init
Sets up the hook.
Method of the class: ComingSoonRequestHandler{}
No Hooks.
Returns
null. Nothing (null).
Usage
$ComingSoonRequestHandler = new ComingSoonRequestHandler(); $ComingSoonRequestHandler->init( $coming_soon_helper );
- $coming_soon_helper(ComingSoonHelper) (required)
- Dependency.
ComingSoonRequestHandler::init() ComingSoonRequestHandler::init code WC 10.3.3
final public function init( ComingSoonHelper $coming_soon_helper ) {
$this->coming_soon_helper = $coming_soon_helper;
// Hook into plugins_loaded to ensure features are initialized to determine coming soon status.
add_action(
'plugins_loaded',
function () {
// Skip if the site is live.
if ( $this->coming_soon_helper->is_site_live() ) {
return;
}
add_filter( 'template_include', array( $this, 'handle_template_include' ) );
add_filter( 'wp_theme_json_data_theme', array( $this, 'experimental_filter_theme_json_theme' ) );
add_action( 'wp_enqueue_scripts', array( $this, 'enqueue_styles' ) );
add_action( 'after_setup_theme', array( $this, 'possibly_init_block_templates' ), 999 );
}
);
}