Automattic\WooCommerce\Blocks\Integrations

IntegrationRegistry::register()publicWC 1.0

Registers an integration.

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

Хуков нет.

Возвращает

true|false. True means registered successfully.

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

$IntegrationRegistry = new IntegrationRegistry();
$IntegrationRegistry->register( $integration );
$integration(IntegrationInterface) (обязательный)
An instance of IntegrationInterface.

Код IntegrationRegistry::register() WC 7.3.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;
}