mirror of
https://github.com/woocommerce/woocommerce-paypal-payments.git
synced 2025-08-30 05:00:51 +08:00
Register the notes in 'Inbox' Woo section
This commit is contained in:
parent
0108779972
commit
7e43288f74
1 changed files with 22 additions and 0 deletions
|
@ -62,6 +62,7 @@ use WooCommerce\PayPalCommerce\WcGateway\Settings\SectionsRenderer;
|
|||
use WooCommerce\PayPalCommerce\WcGateway\Settings\Settings;
|
||||
use WooCommerce\PayPalCommerce\WcGateway\Settings\SettingsListener;
|
||||
use WooCommerce\PayPalCommerce\WcGateway\Settings\SettingsRenderer;
|
||||
use WooCommerce\PayPalCommerce\WcGateway\Settings\WcInboxNotes\InboxNoteRegistrar;
|
||||
use WooCommerce\PayPalCommerce\WcGateway\Settings\WcTasks\Registrar\TaskRegistrarInterface;
|
||||
|
||||
/**
|
||||
|
@ -95,6 +96,7 @@ class WCGatewayModule implements ServiceModule, ExtendingModule, ExecutableModul
|
|||
$this->register_columns( $c );
|
||||
$this->register_checkout_paypal_address_preset( $c );
|
||||
$this->register_wc_tasks( $c );
|
||||
$this->register_woo_inbox_notes( $c );
|
||||
$this->register_void_button( $c );
|
||||
|
||||
if ( ! $c->get( 'wcgateway.settings.admin-settings-enabled' ) ) {
|
||||
|
@ -957,6 +959,26 @@ class WCGatewayModule implements ServiceModule, ExtendingModule, ExecutableModul
|
|||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* Registers inbox notes in the WooCommerce Admin inbox section.
|
||||
*/
|
||||
protected function register_woo_inbox_notes( ContainerInterface $container ): void {
|
||||
add_action(
|
||||
'admin_init',
|
||||
static function () use ( $container ): void {
|
||||
$logger = $container->get( 'woocommerce.logger.woocommerce' );
|
||||
assert( $logger instanceof LoggerInterface );
|
||||
try {
|
||||
$inbox_note_registrar = $container->get( 'wcgateway.settings.inbox-note-registrar' );
|
||||
assert( $inbox_note_registrar instanceof InboxNoteRegistrar );
|
||||
$inbox_note_registrar->register();
|
||||
} catch ( Exception $exception ) {
|
||||
$logger->error( 'Failed to add note to the WooCommerce inbox section. ' . $exception->getMessage() );
|
||||
}
|
||||
},
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* Registers the assets and ajax endpoint for the void button.
|
||||
*
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue