Add the plugin base name

This commit is contained in:
Narek Zakarian 2025-08-04 19:19:53 +04:00
parent 9bf1042a01
commit c48f3e6d2a
No known key found for this signature in database
GPG key ID: 07AFD7E7A9C164A7
2 changed files with 6 additions and 3 deletions

View file

@ -2159,7 +2159,7 @@ return array(
},
'wcgateway.settings.inbox-note-registrar' => static function( ContainerInterface $container ): InboxNoteRegistrar {
return new InboxNoteRegistrar( $container->get( 'wcgateway.settings.inbox-notes' ) );
return new InboxNoteRegistrar( $container->get( 'wcgateway.settings.inbox-notes' ), $container->get( 'ppcp.plugin' ) );
},
/**

View file

@ -9,6 +9,7 @@ namespace WooCommerce\PayPalCommerce\WcGateway\Settings\WcInboxNotes;
use Automattic\WooCommerce\Admin\Notes\Note;
use Automattic\WooCommerce\Admin\Notes\Notes;
use WpOop\WordPress\Plugin\PluginInterface;
/**
* Registers inbox notes in the WooCommerce Admin inbox section.
@ -19,9 +20,11 @@ class InboxNoteRegistrar {
* @var InboxNoteInterface[]
*/
protected array $inbox_notes;
protected PluginInterface $plugin;
public function __construct( array $inbox_notes ) {
public function __construct( array $inbox_notes, PluginInterface $plugin ) {
$this->inbox_notes = $inbox_notes;
$this->plugin = $plugin;
}
public function register(): void {
@ -37,7 +40,7 @@ class InboxNoteRegistrar {
$note->set_content( $inbox_note->content() );
$note->set_type( $inbox_note->type() );
$note->set_name( $inbox_note_name );
$note->set_source( 'your-plugin-name' );
$note->set_source( $this->plugin->getBaseName() );
$note->set_status( $inbox_note->status() );
$inbox_note_action = $inbox_note->action();