Custom System messages defined in module overridden in DB #7980
-
DescriptionI’m hooking in to the SystemMessages::EVENT_REGISTER_MESSAGES event to register my custom message that my module uses. These templates do not show up in the craft_systemmessages table. But if I go to /admin/utilities/system-messages, I see them, and if I choose to edit them there, it adds a row to craft_systemmessages. Craft then uses the DB version, rather than the one I defined in code. Two questions:
Thanks! |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 1 reply
-
That’s exactly how system messages are supposed to work. The plugin/module registers them and their default subject/body text, but then the admin is free to override them.
The change would be ignored, since it’s just a change to the default message text, which the admin has chosen to override with a custom message.
No; if you want that then you shouldn’t be using the system message feature in the first place. Just compose the message and set the subject/body text on it manually. Craft::$app->mailer->compose()
->setSubject('Subject Text')
->setTextBody('Body text')
->setTo('[email protected]')
->send(); |
Beta Was this translation helpful? Give feedback.
That’s exactly how system messages are supposed to work. The plugin/module registers them and their default subject/body text, but then the admin is free to override them.
The change would be ignored, since it’s just a change to the default message text, which the admin has chosen to override with a custom message.
No; if you want that then you shouldn’t be using the system message feature in the first place. Just comp…