[Bugfix] Mail 047999: Fix CC/BCC Mails Generic Placeholder not replaced with corresponding value#11713
[Bugfix] Mail 047999: Fix CC/BCC Mails Generic Placeholder not replaced with corresponding value#11713fhelfer wants to merge 2 commits into
Conversation
… empty resolve in bcc/cc Mails
| 'mail_salutation' => [ | ||
| 'placeholder' => 'MAIL_SALUTATION', | ||
| 'label' => $this->getLanguage()->txt('mail_nacc_salutation'), | ||
| 'requiresRecipient' => true, |
There was a problem hiding this comment.
requiresRecipientshould be part of the array shape definition (PHPDocs)- Maybe there are other placeholders in specific mail template contexts which are also generic (like a course title). Therefore, I carefully ask: Do you see any other approach to achieve the desired behaviour?
There was a problem hiding this comment.
For the interim fix, we also need to add requiresRecipient to all mail contexts. Right now there’s no reliable way to tell which specific placeholders are user-specific vs. context-specific. Generic ones already have it; specific ones don’t — and some contexts still short-circuit everything when there’s no recipient. Study Programme is the worst offender: if (is_null($recipient)) { return ''; } wipes all placeholders, even ones that only need the object/context (title, link, etc.).
Long-term (planned for ILIAS 12): a proper refactor. Placeholders become small classes implementing interfaces, collected the same way mail signatures already work — placeholder classes + a supports() check on the consumer side. Contexts would declare what they support (installation, user, object/course/study programme, …), and only matching placeholders get resolved. That way we reuse placeholders across contexts instead of reimplementing them in every il*MailTemplateContext.
… requireRecipient
https://mantis.ilias.de/view.php?id=47999