Problem/Motivation
When using Smart Dates if you want to use the token to output a date in some plain text email it comes across looking wrong because it has HTML in it. I think it'd be nice to be able to add :plain or something, whatever is best practice, to output the same token but strip out the HTML.
If you give me direction on which method you think is best I'd gladly get that worked out for you and submit a PR.
Steps to reproduce
In my usage I'm using
ECA β
which on a cron send out reminder emails, but really anyway you can get an email to send while pulling an item with a date should work to recreate.
The token usage is:
Please don't forget to show up to the event [event:title] on [event:field_dates].
The outputted email will look like:
Please don't forget to show up, to the event My Test Event on <time datetime="2024-02-29T10:00:00-06:00" class="datetime">Thu, Feb 29 2024, 10</time>
- <time datetime="2024-02-29T11:00:00-06:00" class="datetime">11 am</time>.
Proposed resolution
Like mentioned above, I think allowing someone to specify they don't want the markup would be easiest, I don't assume there is anyway to detect this is going to be used in a plain text format and output different.
I think if we added a new token that was :FORMAT:plain we could then use a new method on smart_date/src/SmartDateTrait.php:formatSmartDate that just calls formatSmartDate but then strips out the tags and returns as plain text. To me that seems like the absolute easiest option but there is probably a more elegant option which might be better considering the scope of this module.
Remaining tasks
Decide if this is a feature you want to add, or if there's a better way to solve this issue.
User interface changes
Not sure.
API changes
Not sure.
Data model changes
Not sure.