Automattic\WooCommerce\Blocks\Domain

Bootstrap::init()protectedWC 1.0

Init the package - load the blocks library and define constants.

Метод класса: Bootstrap{}

Хуков нет.

Возвращает

null. Ничего.

Использование

// protected - в коде основоного (родительского) или дочернего класса
$result = $this->init();

Код Bootstrap::init() WC 7.5.1

protected function init() {
	$this->register_dependencies();
	$this->register_payment_methods();

	if ( $this->package->is_experimental_build() && is_admin() ) {
		if ( $this->package->get_version() !== $this->package->get_version_stored_on_db() ) {
			$this->migration->run_migrations();
			$this->package->set_version_stored_on_db();
		}
	}

	add_action(
		'admin_init',
		function() {
			// Delete this notification because the blocks are included in WC Core now. This will handle any sites
			// with lingering notices.
			InboxNotifications::delete_surface_cart_checkout_blocks_notification();
		},
		10,
		0
	);

	$is_rest = wc()->is_rest_api_request();

	// Load assets in admin and on the frontend.
	if ( ! $is_rest ) {
		$this->add_build_notice();
		$this->container->get( AssetDataRegistry::class );
		$this->container->get( Installer::class );
		$this->container->get( AssetsController::class );
	}
	$this->container->get( DraftOrders::class )->init();
	$this->container->get( CreateAccount::class )->init();
	$this->container->get( StoreApi::class )->init();
	$this->container->get( GoogleAnalytics::class );
	$this->container->get( BlockTypesController::class );
	$this->container->get( BlockTemplatesController::class );
	$this->container->get( ProductSearchResultsTemplate::class );
	$this->container->get( ProductAttributeTemplate::class );
	$this->container->get( ClassicTemplatesCompatibility::class );
	$this->container->get( BlockPatterns::class );
	$this->container->get( PaymentsApi::class );
	$this->container->get( ShippingController::class )->init();
}