}
+ /**
+ * @return array
+ */
public function processVariablesForMailgun()
{
if($this->html === null) {
$match = Str::before(Str::after($matches[0], '{{'), '}}');
$variables[$match] = $match ;
return "%recipient.$match%";
- }, $this->html);
+ }, self::processLinks($this->html));
return $variables;
}
+
+ /**
+ * @param $content
+ * @return string|string[]|null
+ * Transforms data-href-variable="template" to href="{{template}}"
+ */
+ public static function processLinks($content)
+ {
+ return preg_replace_callback('/data-href-variable="([^(" )]*)"/', function($matches){
+ $match = $matches[1];
+ return sprintf('href="{{%s}}"', $match);
+
+ }, $content);
+ }
+
+
}
+
+
+