Add auto registration using the interface

This commit is contained in:
Jeremy Pry 2023-08-14 18:32:51 -04:00 committed by Justin Palmer
parent 87b11e3bbb
commit 95001377b6
No known key found for this signature in database
GPG Key ID: ACAB7C35AA2577AF
1 changed files with 11 additions and 0 deletions

View File

@ -16,6 +16,7 @@ use Automattic\WooCommerce\Internal\Features\FeaturesController;
use Automattic\WooCommerce\Internal\ProductAttributesLookup\DataRegenerator;
use Automattic\WooCommerce\Internal\ProductAttributesLookup\LookupDataStore;
use Automattic\WooCommerce\Internal\ProductDownloads\ApprovedDirectories\Register as ProductDownloadDirectories;
use Automattic\WooCommerce\Internal\RegisterHooksInterface;
use Automattic\WooCommerce\Internal\RestockRefundedItemsAdjuster;
use Automattic\WooCommerce\Internal\Settings\OptionSanitizer;
use Automattic\WooCommerce\Internal\Utilities\WebhookUtil;
@ -262,6 +263,16 @@ final class WooCommerce {
$container->get( FeaturesController::class );
$container->get( WebhookUtil::class );
$container->get( Marketplace::class );
/**
* These classes have a register method for attaching hooks.
*
* @var RegisterHooksInterface[] $hook_register_classes
*/
$hook_register_classes = $container->get( RegisterHooksInterface::class );
foreach ( $hook_register_classes as $hook_register_class ) {
$hook_register_class->register();
}
}
/**