function template_preprocess_commerce_subscription in Commerce Recurring Framework 8
Prepares variables for subscription templates.
Default template: commerce-subscription.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_recurring.module, line 156 - Provides recurring billing for Drupal Commerce.
Code
function template_preprocess_commerce_subscription(array &$variables) {
/** @var \Drupal\commerce_recurring\Entity\SubscriptionInterface $subscription */
$subscription = $variables['elements']['#commerce_subscription'];
$variables['subscription_entity'] = $subscription;
$variables['subscription'] = [];
foreach (Element::children($variables['elements']) as $key) {
$variables['subscription'][$key] = $variables['elements'][$key];
}
}