function template_preprocess_commerce_product_bundle_i in Commerce Product Bundle 8
Prepares variables for product bundle item templates.
Default template: commerce-product-bundle-i.html.twig.
Parameters
array $variables: An associative array containing:
- elements: An associative array containing rendered fields.
- attributes: HTML attributes for the containing element.
File
- ./
commerce_product_bundle.module, line 95 - Contains commerce_product_bundle.module.
Code
function template_preprocess_commerce_product_bundle_i(array &$variables) {
/** @var Drupal\commerce_product_bundle\Entity\BundleItemInterface $product_bundle_item */
$product_bundle_item = $variables['elements']['#commerce_product_bundle_i'];
$variables['product_bundle_item_entity'] = $product_bundle_item;
$variables['product_bundle_item'] = [];
foreach (Element::children($variables['elements']) as $key) {
$variables['product_bundle_item'][$key] = $variables['elements'][$key];
}
}