Skip to content

Instantly share code, notes, and snippets.

@tobiasfabian
Last active October 2, 2015 14:21
Show Gist options
  • Save tobiasfabian/4249557df71efb14be71 to your computer and use it in GitHub Desktop.
Save tobiasfabian/4249557df71efb14be71 to your computer and use it in GitHub Desktop.
kirbytext: email with subject
<?php
kirbytext::$tags['email'] = array(
'attr' => array(
'text',
'subject'
),
'html' => function($tag) {
$email = $tag->attr('email');
$text = $tag->attr('text', $email);
$subject = rawurlencode($tag->attr('subject',null));
$query = ($subject) ? '?subject='.$subject : null;
return '<a href="mailto:'.$email.$query.'">'.$text.'</a>';
}
);
(email: name@domain.com subject: reserve tickets)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment