@@ -53,14 +53,10 @@ public function __construct( SV_WC_Payment_Gateway_Plugin $plugin ) {
5353
5454 $ this ->plugin = $ plugin ;
5555
56- parent ::__construct ( $ plugin -> get_plugin_name () );
56+ parent ::__construct ();
5757
5858 // add the action & filter hooks
5959 $ this ->add_hooks ();
60-
61- // add the token exporters & erasers
62- $ this ->add_exporter ( "wc- {$ plugin ->get_id_dasherized ()}-customer-tokens " , __ ( "{$ plugin ->get_plugin_name ()} Payment Tokens " , 'woocommerce-plugin-framework ' ), array ( $ this , 'customer_tokens_exporter ' ) );
63- $ this ->add_eraser ( "wc- {$ plugin ->get_id_dasherized ()}-customer-tokens " , __ ( "{$ plugin ->get_plugin_name ()} Payment Tokens " , 'woocommerce-plugin-framework ' ), array ( $ this , 'customer_tokens_eraser ' ) );
6460 }
6561
6662
@@ -71,6 +67,9 @@ public function __construct( SV_WC_Payment_Gateway_Plugin $plugin ) {
7167 */
7268 protected function add_hooks () {
7369
70+ // initializes data exporters and erasers
71+ add_action ('init ' , [$ this , 'registerExportersAndErasers ' ]);
72+
7473 // add the gateway data to customer data exports
7574 add_filter ( 'woocommerce_privacy_export_customer_personal_data ' , array ( $ this , 'add_export_customer_data ' ), 10 , 2 );
7675
@@ -84,6 +83,20 @@ protected function add_hooks() {
8483 add_action ( 'woocommerce_privacy_remove_order_personal_data ' , array ( $ this , 'remove_order_personal_data ' ) );
8584 }
8685
86+ /**
87+ * Initial registration of privacy erasers and exporters.
88+ *
89+ * Due to the use of translation functions, this should run only on/after init.
90+ */
91+ public function registerExportersAndErasers ()
92+ {
93+ $ this ->name = $ this ->plugin ->get_plugin_name ();
94+
95+ // add the token exporters & erasers
96+ $ this ->add_exporter ("wc- {$ this ->plugin ->get_id_dasherized ()}-customer-tokens " , __ ("{$ this ->plugin ->get_plugin_name ()} Payment Tokens " , 'woocommerce-plugin-framework ' ), [$ this , 'customer_tokens_exporter ' ]);
97+ $ this ->add_eraser ("wc- {$ this ->plugin ->get_id_dasherized ()}-customer-tokens " , __ ("{$ this ->plugin ->get_plugin_name ()} Payment Tokens " , 'woocommerce-plugin-framework ' ), [$ this , 'customer_tokens_eraser ' ]);
98+ }
99+
87100
88101 /** Customer methods ******************************************************/
89102
0 commit comments