| Total Complexity | 4 |
| Total Lines | 54 |
| Duplicated Lines | 0 % |
| Changes | 0 | ||
| 1 | <?php |
||
| 9 | class Shippable extends Purchasable |
||
| 10 | { |
||
| 11 | /** |
||
| 12 | * @var array |
||
| 13 | */ |
||
| 14 | private static $db = [ |
||
|
|
|||
| 15 | 'Weight' => 'Decimal', |
||
| 16 | ]; |
||
| 17 | |||
| 18 | /** |
||
| 19 | * @var array |
||
| 20 | */ |
||
| 21 | private static $defaults = [ |
||
| 22 | 'Weight' => '0.0', |
||
| 23 | ]; |
||
| 24 | |||
| 25 | /** |
||
| 26 | * @param bool $includerelations |
||
| 27 | * |
||
| 28 | * @return array |
||
| 29 | */ |
||
| 30 | public function updateFieldLabels(&$labels) |
||
| 31 | { |
||
| 32 | $labels['Weight'] = _t(__CLASS__ . '.WeightLabel', 'Weight'); |
||
| 33 | } |
||
| 34 | |||
| 35 | /** |
||
| 36 | * @param FieldList $fields |
||
| 37 | */ |
||
| 38 | public function updateCMSFields(FieldList $fields) |
||
| 39 | { |
||
| 40 | $fields->addFieldsToTab( |
||
| 41 | 'Root.Main', |
||
| 42 | [ |
||
| 43 | NumericField::create('Weight') |
||
| 44 | ->setTitle(_t('ProductPage.Weight', 'Weight')) |
||
| 45 | ->setDescription(_t( |
||
| 46 | 'ProductPage.WeightDescription', |
||
| 47 | 'Base weight for this product in lbs. Can be modified using Product Options' |
||
| 48 | )) |
||
| 49 | ->setScale(2), |
||
| 50 | ], |
||
| 51 | 'Content' |
||
| 52 | ); |
||
| 53 | } |
||
| 54 | |||
| 55 | /** |
||
| 56 | * @return \SilverStripe\ORM\ValidationResult |
||
| 57 | */ |
||
| 58 | public function validate(ValidationResult $validationResult) |
||
| 63 | ); |
||
| 64 | } |
||
| 65 | } |
||
| 67 |