Conditions | 3 |
Paths | 3 |
Total Lines | 21 |
Code Lines | 14 |
Lines | 0 |
Ratio | 0 % |
Changes | 0 |
1 | <?php |
||
5 | public function __construct(Controller $controller, $name, FieldList $fields, FieldList $actions, $validator = null) |
||
6 | { |
||
7 | $requiredFields = array( |
||
8 | 'ReceiverName', |
||
9 | 'ReceiverPhone', |
||
10 | 'ReceiverEmail', |
||
11 | 'DeliveryAddressLine1', |
||
12 | 'DeliveryAddressCountry', |
||
13 | 'DeliveryAddressPostCode', |
||
14 | ); |
||
15 | foreach ($fields as $field) { |
||
16 | if (in_array($field->name, $requiredFields)) { |
||
17 | $field->addExtraClass('requiredField'); |
||
18 | } |
||
19 | } |
||
20 | $validator = new RequiredFields($requiredFields); |
||
21 | |||
22 | $actions->push(new FormAction('doRequestSend', 'Send your request')); |
||
23 | |||
24 | parent::__construct($controller, $name, $fields, $actions, $validator); |
||
25 | } |
||
26 | |||
32 |
You can fix this by adding a namespace to your class:
When choosing a vendor namespace, try to pick something that is not too generic to avoid conflicts with other libraries.