Skip to content

Commit 7c286c0

Browse files
committed
Issue #2871709 part 2: Add support for included adjustments in the UI.
1 parent 0f3852c commit 7c286c0

1 file changed

Lines changed: 6 additions & 1 deletion

File tree

modules/order/src/Plugin/Field/FieldWidget/AdjustmentDefaultWidget.php

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -73,7 +73,6 @@ public function formElement(FieldItemListInterface $items, $delta, array $elemen
7373
'#title' => $this->t('Label'),
7474
'#default_value' => ($adjustment) ? $adjustment->getLabel() : '',
7575
];
76-
7776
$element['definition']['amount'] = [
7877
'#type' => 'commerce_price',
7978
'#title' => t('Amount'),
@@ -85,6 +84,11 @@ public function formElement(FieldItemListInterface $items, $delta, array $elemen
8584
],
8685
],
8786
];
87+
$element['definition']['included'] = [
88+
'#type' => 'checkbox',
89+
'#title' => t('Included in the base price'),
90+
'#default_value' => ($adjustment) ? $adjustment->isIncluded() : FALSE,
91+
];
8892

8993
return $element;
9094
}
@@ -103,6 +107,7 @@ public function massageFormValues(array $values, array $form, FormStateInterface
103107
'label' => $value['definition']['label'],
104108
'amount' => new Price($value['definition']['amount']['number'], $value['definition']['amount']['currency_code']),
105109
'source_id' => $value['source_id'],
110+
'included' => $value['definition']['included'],
106111
]);
107112
}
108113
return $values;

0 commit comments

Comments
 (0)