@@ -53,14 +53,10 @@ public function __construct( SV_WC_Payment_Gateway_Plugin $plugin ) {
53
53
54
54
$ this ->plugin = $ plugin ;
55
55
56
- parent ::__construct ( $ plugin -> get_plugin_name () );
56
+ parent ::__construct ();
57
57
58
58
// add the action & filter hooks
59
59
$ 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 ' ) );
64
60
}
65
61
66
62
@@ -71,6 +67,9 @@ public function __construct( SV_WC_Payment_Gateway_Plugin $plugin ) {
71
67
*/
72
68
protected function add_hooks () {
73
69
70
+ // initializes data exporters and erasers
71
+ add_action ('init ' , [$ this , 'registerExportersAndErasers ' ]);
72
+
74
73
// add the gateway data to customer data exports
75
74
add_filter ( 'woocommerce_privacy_export_customer_personal_data ' , array ( $ this , 'add_export_customer_data ' ), 10 , 2 );
76
75
@@ -84,6 +83,20 @@ protected function add_hooks() {
84
83
add_action ( 'woocommerce_privacy_remove_order_personal_data ' , array ( $ this , 'remove_order_personal_data ' ) );
85
84
}
86
85
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
+
87
100
88
101
/** Customer methods ******************************************************/
89
102
0 commit comments