You are here

protected function ProductTypeForm::getOrderItemTypeIds in Commerce Core 8.2

Gets the available order item type IDs.

Only order item types that can be used to purchase product variations are included.

Return value

string[] The order item type IDs.

2 calls to ProductTypeForm::getOrderItemTypeIds()
ProductTypeForm::submitForm in modules/product/src/Form/ProductTypeForm.php
This is the default entity object builder function. It is called before any other submit handler to build the new entity object to be used by the following submit handlers. At this point of the form workflow the entity is validated and the form state…
ProductTypeForm::validateForm in modules/product/src/Form/ProductTypeForm.php
Form validation handler.

File

modules/product/src/Form/ProductTypeForm.php, line 257

Class

ProductTypeForm

Namespace

Drupal\commerce_product\Form

Code

protected function getOrderItemTypeIds() {
  $order_item_type_storage = $this->entityTypeManager
    ->getStorage('commerce_order_item_type');
  $order_item_types = $order_item_type_storage
    ->loadMultiple();
  $order_item_types = array_filter($order_item_types, function (OrderItemTypeInterface $type) {
    return $type
      ->getPurchasableEntityTypeId() == 'commerce_product_variation';
  });
  return array_keys($order_item_types);
}