Skip to content

Commit 17ef16c

Browse files
author
Simon L. Lange
committed
Faxe-378: Email template
1 parent 3989873 commit 17ef16c

File tree

1 file changed

+31
-5
lines changed

1 file changed

+31
-5
lines changed

web/themes/custom/fds_faxe_theme/fds_faxe_theme.theme

Lines changed: 31 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -91,32 +91,58 @@ function fds_faxe_theme_preprocess_swiftmailer(&$variables) {
9191
}
9292
}
9393

94+
function fds_faxe_theme_preprocess_anonymous_subscriptions_notification_email(&$variables) {
95+
global $base_url;
96+
$language = \Drupal::languageManager()->getCurrentLanguage()->getId();
97+
$theme = \Drupal::theme()->getActiveTheme();
98+
$theme_path = $base_url . '/' . $theme->getPath();
99+
100+
// Theme settings.
101+
$theme_settings = _fds_base_theme_collect_theme_settings();
102+
$variables['current_language'] = $language;
103+
$variables['base_url'] = $GLOBALS['base_url'] . '/';
104+
$variables['logo_url'] = $theme_path . '/dist/images/logo--mail.png';
105+
$variables['theme_settings'] = $theme_settings;
106+
107+
// Header logo.
108+
if (!empty($theme_settings['language_logo']['header_logo__' . $language])) {
109+
$file = File::load($theme_settings['language_logo']['header_logo__' . $language]);
110+
if (!empty($file)) {
111+
$variables['logo_url'] = file_create_url($file->getFileUri());
112+
}
113+
}
114+
}
115+
94116
/**
95117
* Implements hook_preprocess_HOOK().
96118
*/
97119
function fds_faxe_theme_preprocess_anonymous_subscriptions_message(array &$variables) {
98-
99120
global $base_url;
100121
$language = \Drupal::languageManager()->getCurrentLanguage()->getId();
101122
$theme = \Drupal::theme()->getActiveTheme();
102123
$theme_path = $base_url . '/' . $theme->getPath();
103-
$variables['logo_url'] = $theme_path . '/dist/images/logo--mail.png';
124+
125+
// Theme settings.
126+
$theme_settings = _fds_base_theme_collect_theme_settings();
127+
$variables['current_language'] = $language;
104128
$variables['base_url'] = $GLOBALS['base_url'] . '/';
129+
$variables['logo_url'] = $theme_path . '/dist/images/logo--mail.png';
130+
$variables['theme_settings'] = $theme_settings;
105131

132+
// Header logo.
106133
if (!empty($theme_settings['language_logo']['header_logo__' . $language])) {
107134
$file = File::load($theme_settings['language_logo']['header_logo__' . $language]);
108135
if (!empty($file)) {
109-
$variables['logo_url'] = \Drupal::service('file_url_generator')->generateAbsoluteString($file->getFileUri());
136+
$variables['logo_url'] = file_create_url($file->getFileUri());
110137
}
111138
}
112-
113139
$subscription = $variables['subscription'];
114140
if (!empty($subscription->type->value) && $subscription->type->value == 'os2web_hearings_hearing_case') {
115141
$variables['link'] = Link::fromTextAndUrl(t('Klik her for at gå til høringer og afgørelser'), Url::fromUserInput('/hoeringer-og-afgoerelser'));
116142
}
143+
}
117144

118145

119-
}
120146

121147
/**
122148
* Implements hook_preprocess_term().

0 commit comments

Comments
 (0)