You are here

function easy_email_commerce_theme in Easy Email 2.0.x

Implements hook_theme().

File

modules/easy_email_commerce/easy_email_commerce.module, line 77

Code

function easy_email_commerce_theme($existing, $type, $theme, $path) {
  $templates = [];
  foreach (easy_email_commerce_template_by_token() as $entity_type => $tokens) {
    foreach ($tokens as $token => $info) {
      $templates[$info['template']] = [
        'variables' => [
          $entity_type => NULL,
        ],
      ];
      if ($entity_type === 'commerce_order') {
        $templates[$info['template']]['variables']['totals'] = NULL;
        $templates[$info['template']]['variables']['billing_information'] = NULL;
        $templates[$info['template']]['variables']['shipping_information'] = NULL;
        $templates[$info['template']]['variables']['payment_method'] = NULL;
      }
    }
  }
  return $templates;
}