Conditions | 3 |
Paths | 3 |
Total Lines | 26 |
Lines | 0 |
Ratio | 0 % |
Changes | 0 |
1 | <?php |
||
34 | public function __construct() |
||
35 | { |
||
36 | parent::__construct(); |
||
37 | $children = FieldList::create(); |
||
38 | |||
39 | if ($gateways = GatewayInfo::getSupportedGateways(true)) { |
||
40 | $this->extend('updateGateways', $gateways); |
||
41 | |||
42 | if (count($gateways) > 1) { |
||
43 | $children->add(OptionsetField::create( |
||
44 | 'Gateway', |
||
45 | _t('PaymentGatewayField.SELECT_GATEWAY', 'Select a gateway'), |
||
46 | $gateways |
||
47 | )->setValue(key($gateways))); |
||
48 | } else { |
||
49 | $children->add(HiddenField::create('Gateway', 'Gateway', key($gateways))); |
||
50 | } |
||
51 | } else { |
||
52 | $children->add( |
||
53 | LiteralField::create('NoGateway', "<p>No gateways configured</p>") |
||
54 | ); |
||
55 | } |
||
56 | |||
57 | $this->extend('updateGatewayField'); |
||
58 | $this->setChildren($children); |
||
59 | } |
||
60 | } |