-
-
Notifications
You must be signed in to change notification settings - Fork 73
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add a placeholder for a link to the submission in the Control Panel #2220
Comments
We've got plans to expand the functionality of these placeholders/variables that will likely allow for this sort of advanced behaviour. |
@engram-design That looks really promising! Any idea when those changes might be implemented? We have a signup form where a link to the submission would be really helpful, and I couldn't find a good workaround yet. |
Not until later this year I'm afraid in 2.3.0. So I suppose this depends on your email client as well. For example, my Mac Mail seems to render the link as HTML. But in any case, I've added handling for you to register your own variables. They were half-done, but didn't feature a way to handle parsing logic. use craft\helpers\Html;
use craft\helpers\Template;
use verbb\formie\events\RegisterVariablesEvent;
use verbb\formie\events\ParseVariablesEvent;
use verbb\formie\helpers\Variables;
use yii\base\Event;
Event::on(Variables::class, Variables::EVENT_REGISTER_VARIABLES, function(RegisterVariablesEvent $event) {
$event->variables['custom'][] = [
'label' => 'Custom',
'heading' => true,
];
$event->variables['custom'][] = [
'label' => 'Submission URL HTML',
'value' => '{submissionUrlHtml}',
];
});
Event::on(Variables::class, Variables::EVENT_PARSE_VARIABLES, function(ParseVariablesEvent $event) {
if ($event->submission) {
$event->variables['submissionUrlHtml'] = Template::raw(Html::tag('a', $event->submission->title, ['href' => $event->submission->cpEditUrl]));
}
}); Which will give you a new option in the variable picker, and output the raw HTML to the To get this early, run |
@engram-design Got it, thanks!
Interesting – since it's already an HTML mail, that's probably some kind of link detection algorithm? I'll check what my clients use in this case.
Thank you for the addition and the example, that's great! We'll use that to implement the link 💯 |
Updated in 2.1.39 |
What are you trying to do?
We want to include a link to the submission in an email notification. There's a placeholder with that URL available:
However, that only outputs the URL as plain text:
That's inconvenient because you have to select the URL and copy-and-paste it into a new browser tab, instead of just clicking on a link.
What's your proposed solution?
Add a new placeholder
Submission CP link
that outputs a link. The link should have theSubmission CP URL
as itshref
, and the submissiontitle
as the link text, or just the URL as the link text so it's clickable.Ideally, the link text would be configurable, though I'm not sure if that is possible with those placeholders. Alternatively, the rich text editor that already has buttons for bold and italic text could be extended to provide a link button, where you can use a placeholder as the
href
and write a custom link text.Additional context
No response
The text was updated successfully, but these errors were encountered: