|
1
|
|
|
<?php |
|
2
|
|
|
|
|
3
|
|
|
namespace AntonyThorpe\SilvershopBankDeposit; |
|
4
|
|
|
|
|
5
|
|
|
use SilverStripe\Core\Extension; |
|
6
|
|
|
use SilverStripe\SiteConfig\SiteConfig; |
|
7
|
|
|
use SilverStripe\Forms\TextareaField; |
|
8
|
|
|
use SilverStripe\Forms\TextField; |
|
9
|
|
|
use SilverStripe\Forms\HTMLEditor\HTMLEditorField; |
|
10
|
|
|
use SilverStripe\Forms\FieldList; |
|
11
|
|
|
|
|
12
|
|
|
/** |
|
13
|
|
|
* @property ?string $BankAccountPaymentMethodMessage |
|
14
|
|
|
* @property ?string $BankAccountNumber |
|
15
|
|
|
* @property ?string $BankAccountDetails |
|
16
|
|
|
* @property ?string $BankAccountInvoiceMessage |
|
17
|
|
|
* @extends Extension<SiteConfig&static> |
|
18
|
|
|
*/ |
|
19
|
|
|
class ShopConfigExtension extends Extension |
|
20
|
|
|
{ |
|
21
|
|
|
private static array $db = [ |
|
|
|
|
|
|
22
|
|
|
'BankAccountPaymentMethodMessage' => 'Text', |
|
23
|
|
|
'BankAccountNumber' => 'Text', |
|
24
|
|
|
'BankAccountDetails' => 'Text', |
|
25
|
|
|
'BankAccountInvoiceMessage' => 'HTMLText' |
|
26
|
|
|
]; |
|
27
|
|
|
|
|
28
|
|
|
public function updateCMSFields(FieldList $fieldList): void |
|
29
|
|
|
{ |
|
30
|
|
|
$fieldList->addFieldsToTab( |
|
31
|
|
|
'Root.Shop.ShopTabs.' . _t('SilverShop\Extension\ShopConfigExtension.BankAccountTitle', 'Bank Account'), |
|
32
|
|
|
[ |
|
33
|
|
|
Textfield::create( |
|
34
|
|
|
"BankAccountPaymentMethodMessage", |
|
35
|
|
|
_t( |
|
36
|
|
|
"SilverShop\\Extension\\ShopConfigExtension.BankAccountPaymentMethodMessage", |
|
37
|
|
|
"Payment Method message on Checkout page" |
|
38
|
|
|
) |
|
39
|
|
|
)->setDescription( |
|
40
|
|
|
_t( |
|
41
|
|
|
"SilverShop\\Extension\\ShopConfigExtension.BankAccountPaymentMethodMessageDescription", |
|
42
|
|
|
"Message to appear in the Payment Method section of Checkout Page" |
|
43
|
|
|
) |
|
44
|
|
|
), |
|
45
|
|
|
Textfield::create( |
|
46
|
|
|
"BankAccountNumber", |
|
47
|
|
|
_t( |
|
48
|
|
|
"SilverShop\\Extension\\ShopConfigExtension.BankAccountNumber", |
|
49
|
|
|
"Bank Account Number" |
|
50
|
|
|
) |
|
51
|
|
|
)->setDescription( |
|
52
|
|
|
_t( |
|
53
|
|
|
"SilverShop\\Extension\\ShopConfigExtension.BankAccountNumberDescription", |
|
54
|
|
|
"e.g XX-XXXX-XXXXXXX-XX" |
|
55
|
|
|
) |
|
56
|
|
|
), |
|
57
|
|
|
TextareaField::create( |
|
58
|
|
|
"BankAccountDetails", |
|
59
|
|
|
_t( |
|
60
|
|
|
"SilverShop\\Extension\\ShopConfigExtension.BankAccountDetails", |
|
61
|
|
|
"Bank Account Details" |
|
62
|
|
|
) |
|
63
|
|
|
)->setDescription( |
|
64
|
|
|
_t( |
|
65
|
|
|
"SilverShop\\Extension\\ShopConfigExtension.BankAccountDetailsDescription", |
|
66
|
|
|
"Account Name, Bank Name, Branch, Branch Address" |
|
67
|
|
|
) |
|
68
|
|
|
), |
|
69
|
|
|
HtmlEditorField::create( |
|
70
|
|
|
"BankAccountInvoiceMessage", |
|
71
|
|
|
_t( |
|
72
|
|
|
"SilverShop\\Extension\\ShopConfigExtension.BankAccountInvoiceMessage", |
|
73
|
|
|
"Bank Account Order/Invoice Message" |
|
74
|
|
|
) |
|
75
|
|
|
)->setDescription( |
|
76
|
|
|
_t( |
|
77
|
|
|
"SilverShop\\Extension\\ShopConfigExtension.BankAccountInvoiceMessageDescription", |
|
78
|
|
|
"Message to appear on the order/invoice" |
|
79
|
|
|
) |
|
80
|
|
|
) |
|
81
|
|
|
] |
|
82
|
|
|
); |
|
83
|
|
|
} |
|
84
|
|
|
} |
|
85
|
|
|
|