Automattic\WooCommerce\Blocks\Integrations

IntegrationRegistry::initialize()publicWC 1.0

Initializes all registered integrations.

Integration identifier is used to construct hook names and is given when the integration registry is initialized.

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

Возвращает

null. Ничего (null).

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

$IntegrationRegistry = new IntegrationRegistry();
$IntegrationRegistry->initialize( $registry_identifier );
$registry_identifier(строка)
Identifier for this registry.
По умолчанию: ''

Код IntegrationRegistry::initialize() WC 8.7.0

public function initialize( $registry_identifier = '' ) {
	if ( $registry_identifier ) {
		$this->registry_identifier = $registry_identifier;
	}

	if ( empty( $this->registry_identifier ) ) {
		_doing_it_wrong( __METHOD__, esc_html__( 'Integration registry requires an identifier.', 'woocommerce' ), '4.6.0' );
		return false;
	}

	/**
	 * Fires when the IntegrationRegistry is initialized.
	 *
	 * Runs before integrations are initialized allowing new integration to be registered for use. This should be
	 * used as the primary hook for integrations to include their scripts, styles, and other code extending the
	 * blocks.
	 *
	 * @since 4.6.0
	 *
	 * @param IntegrationRegistry $this Instance of the IntegrationRegistry class which exposes the IntegrationRegistry::register() method.
	 */
	do_action( 'woocommerce_blocks_' . $this->registry_identifier . '_registration', $this );

	foreach ( $this->get_all_registered() as $registered_integration ) {
		$registered_integration->initialize();
	}
}