You are here

function template_preprocess_commerce_pricelist in Commerce Pricelist 8.2

Prepares variables for price list templates.

Default template: commerce-price-list.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_pricelist.module, line 109
Allows defining prices for specific stores, customers, quantities.

Code

function template_preprocess_commerce_pricelist(array &$variables) {

  /** @var Drupal\commerce_pricelist\Entity\PriceListInterface $price_list */
  $price_list = $variables['elements']['#commerce_pricelist'];
  $variables['price_list_entity'] = $price_list;
  $variables['price_list'] = [];
  foreach (Element::children($variables['elements']) as $key) {
    $variables['price_list'][$key] = $variables['elements'][$key];
  }
}