Bootstrap
in package
Takes care of bootstrapping the plugin.
Tags
Table of Contents
- $container : Container
- Holds the Dependency Injection Container
- $package : Package
- Holds the Package instance
- __construct() : mixed
- Constructor
- maybe_register_blocks_from_content() : string
- Register WooCommerce block types on demand when a description containing one is rendered.
- add_build_notice() : mixed
- Add a notice stating that the build has not been done yet.
- deprecated_dependency() : mixed
- Throws a deprecation notice for a dependency without breaking requests.
- init() : mixed
- Init the package - load the blocks library and define constants.
- is_built() : bool
- See if files have been built or not.
- register_dependencies() : mixed
- Register core dependencies with the container.
- register_payment_methods() : mixed
- Register payment method integrations with the container.
- is_block_editor_unified_assets_enabled_during_bootstrap() : bool
- Check whether unified block editor assets are enabled during plugin bootstrap.
Properties
$container
Holds the Dependency Injection Container
private
Container
$container
$package
Holds the Package instance
private
Package
$package
Methods
__construct()
Constructor
public
__construct(Container $container) : mixed
Parameters
- $container : Container
-
The Dependency Injection Container.
Return values
mixed —maybe_register_blocks_from_content()
Register WooCommerce block types on demand when a description containing one is rendered.
public
maybe_register_blocks_from_content(string $content) : string
Eager block registration is skipped on non-rendering requests (Store API, REST, AJAX, webhooks), but product and variation descriptions still run through do_blocks there, so a WooCommerce block in a description would render empty. Hooked to woocommerce_short_description just before do_blocks.
The detection also fires on a synced pattern reference (core/block, wp:block): the referenced pattern's
content is not available here without fetching it, so registration happens defensively in case it
contains a WooCommerce block; registering covers nested blocks at any depth.
Parameters
- $content : string
-
The description content passed through the filter.
Tags
Return values
string — The unchanged content.add_build_notice()
Add a notice stating that the build has not been done yet.
protected
add_build_notice() : mixed
Return values
mixed —deprecated_dependency()
Throws a deprecation notice for a dependency without breaking requests.
protected
deprecated_dependency(string $function, string $version[, string $replacement = '' ][, string $trigger_error_version = '' ]) : mixed
Parameters
- $function : string
-
Class or function being deprecated.
- $version : string
-
Version in which it was deprecated.
- $replacement : string = ''
-
Replacement class or function, if applicable.
- $trigger_error_version : string = ''
-
Optional version to start surfacing this as a PHP error rather than a log. Defaults to $version.
Return values
mixed —init()
Init the package - load the blocks library and define constants.
protected
init() : mixed
Return values
mixed —is_built()
See if files have been built or not.
protected
is_built() : bool
Return values
bool —register_dependencies()
Register core dependencies with the container.
protected
register_dependencies() : mixed
Return values
mixed —register_payment_methods()
Register payment method integrations with the container.
protected
register_payment_methods() : mixed
Return values
mixed —is_block_editor_unified_assets_enabled_during_bootstrap()
Check whether unified block editor assets are enabled during plugin bootstrap.
private
is_block_editor_unified_assets_enabled_during_bootstrap() : bool
Feature definitions contain translated presentation strings and are not safe to use before init.
