email template current year

This commit is contained in:
yuri
2019-01-16 11:29:37 +02:00
parent 34135f0e17
commit 99bf56d031
3 changed files with 7 additions and 1 deletions
@@ -29,6 +29,7 @@
"placeholderTexts": {
"today": "Today's date",
"now": "Current date & time",
"currentYear": "Current Year",
"optOutUrl": "URL for an unsubsbribe link",
"optOutLink": "an unsubscribe link"
}
@@ -43,6 +43,6 @@
"filterList": [
"actual"
],
"placeholderList": ["today", "now", "optOutUrl", "optOutLink"],
"placeholderList": ["today", "now", "currentYear", "optOutUrl", "optOutLink"],
"iconClass": "fas fa-envelope-square"
}
@@ -276,6 +276,11 @@ class EmailTemplate extends Record
$replaceData['today'] = $this->getDateTime()->getTodayString();
$replaceData['now'] = $this->getDateTime()->getNowString();
$timeZone = $this->getConfig()->get('timeZone');
$now = new \DateTime('now', new \DateTimezone($timeZone));
$replaceData['currentYear'] = $now->format('Y');
foreach ($replaceData as $key => $value) {
$text = str_replace('{' . $key . '}', $value, $text);
}