mirror of
https://github.com/woocommerce/woocommerce-paypal-payments.git
synced 2025-08-31 06:52:50 +08:00
Apply styles from settings
This commit is contained in:
parent
27835fc51a
commit
5615994128
3 changed files with 62 additions and 16 deletions
|
@ -642,7 +642,8 @@ class AxoManager {
|
|||
return {
|
||||
fields: {
|
||||
cardholderName: {} // optionally pass this to show the card holder name
|
||||
}
|
||||
},
|
||||
styles: this.remove_keys_with_empty_string(this.axoConfig.style_options)
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -743,6 +744,20 @@ class AxoManager {
|
|||
return this.axoConfig?.widgets?.email === 'use_widget';
|
||||
}
|
||||
|
||||
remove_keys_with_empty_string = (obj) => {
|
||||
for(let key of Object.keys(obj)){
|
||||
if (obj[key] === ''){
|
||||
delete obj[key];
|
||||
}
|
||||
else if (typeof obj[key] === 'object'){
|
||||
obj[key] = this.remove_keys_with_empty_string(obj[key]);
|
||||
if (Object.keys(obj[key]).length === 0 ) delete obj[key];
|
||||
}
|
||||
}
|
||||
|
||||
return Array.isArray(obj) ? obj.filter(val => val) : obj;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
export default AxoManager;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue