email template current year
This commit is contained in:
@@ -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);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user