Issue
I would like to create custom confirmation messages that could be easily updated by the admins.
Like
<textarea>You can contact {contact_name} located at {contact_place}…</textarea>
contact_name and contact_place are fields that will be completed in the same form, and are both required.
Is it something easy to manage?
Solution
Save the text string with placeholders in db, then use str_replace in custom Helper or in entity virtual fields
return str_replace(
[
'{{contact_name}}', // placeholders
'{{contact_place}}',
'{{email}}',
],
[
$contact->name, // inputs
$contact->place,
$contact->email,
],
// load template string from db
// You can contact {{contact_name}} located at {{contact_place}}…
$admin->template
);
Answered By - Salines
0 Comments:
Post a Comment
Note: Only a member of this blog may post a comment.