You are here

protected function ComputedDefaultVariation::computeValue in Commerce Core 8.2

Computes the values for an item list.

Overrides ComputedItemListTrait::computeValue

File

modules/product/src/Plugin/Field/ComputedDefaultVariation.php, line 18

Class

ComputedDefaultVariation
Computed field item list for the default_variation field.

Namespace

Drupal\commerce_product\Plugin\Field

Code

protected function computeValue() {
  $product = $this
    ->getEntity();
  assert($product instanceof ProductInterface);
  $this->list[0] = $this
    ->createItem(0, $product
    ->getDefaultVariation());
}