public function XquantityWidget::formElement in Commerce Extended Quantity 8
File
- src/
Plugin/ Field/ FieldWidget/ XquantityWidget.php, line 282
Class
- XquantityWidget
- Overrides the 'xnumber' widget.
Namespace
Drupal\commerce_xquantity\Plugin\Field\FieldWidgetCode
public function formElement(FieldItemListInterface $items, $delta, array $element, array &$form, FormStateInterface $form_state) {
$element = parent::formElement($items, $delta, $element, $form, $form_state);
$form_object = $form_state
->getFormObject();
$order_item = $form_object
->getEntity();
if ($order_item
->getEntityTypeId() == 'commerce_order_item') {
$order_item
->setQuantityPrices($form_object, $this, $form_state);
}
return $element;
}