protected function AddToCart::loadVariations in Commerce Cart Flyout 8
Load variations for the product.
Parameters
\Drupal\commerce_product\Entity\ProductInterface $product: The product.
Return value
\Drupal\commerce_product\Entity\ProductVariationInterface[] The variations keyed by UUID.
1 call to AddToCart::loadVariations()
- AddToCart::viewElements in src/
Plugin/ Field/ FieldFormatter/ AddToCart.php - Builds a renderable array for a field value.
File
- src/
Plugin/ Field/ FieldFormatter/ AddToCart.php, line 315
Class
- AddToCart
- Plugin implementation of the 'commerce_cart_flyout_add_to_cart' formatter.
Namespace
Drupal\commerce_cart_flyout\Plugin\Field\FieldFormatterCode
protected function loadVariations(ProductInterface $product) {
return array_reduce($this->variationStorage
->loadEnabled($product), function ($carry, ProductVariationInterface $variation) {
$carry[$variation
->uuid()] = $variation;
return $carry;
}, []);
}