Automattic\WooCommerce\Blocks\Integrations

IntegrationRegistry::register()publicWC 1.0

Registers an integration.

Method of the class: IntegrationRegistry{}

No Hooks.

Return

true|false. True means registered successfully.

Usage

$IntegrationRegistry = new IntegrationRegistry();
$IntegrationRegistry->register( $integration );
$integration(IntegrationInterface) (required)
An instance of IntegrationInterface.

IntegrationRegistry::register() code WC 8.7.0

public function register( IntegrationInterface $integration ) {
	$name = $integration->get_name();

	if ( $this->is_registered( $name ) ) {
		/* translators: %s: Integration name. */
		_doing_it_wrong( __METHOD__, esc_html( sprintf( __( '"%s" is already registered.', 'woocommerce' ), $name ) ), '4.6.0' );
		return false;
	}

	$this->registered_integrations[ $name ] = $integration;
	return true;
}