system template inline attachments

This commit is contained in:
Yuri Kuznetsov
2022-09-13 10:12:28 +03:00
parent ac3884179e
commit adbb46d02c
3 changed files with 18 additions and 5 deletions
+6 -3
View File
@@ -133,7 +133,8 @@ class Htmlizer
string $template,
?string $cacheId = null,
?array $additionalData = null,
bool $skipLinks = false
bool $skipLinks = false,
bool $skipInlineAttachmentHandling = false
): string {
$template = str_replace('<tcpdf ', '', $template);
@@ -188,9 +189,11 @@ class Htmlizer
$html = $renderer($data);
$html = str_replace('?entryPoint=attachment&amp;', '?entryPoint=attachment&', $html);
if (!$skipInlineAttachmentHandling) {
$html = str_replace('?entryPoint=attachment&amp;', '?entryPoint=attachment&', $html);
}
if ($this->entityManager) {
if (!$skipInlineAttachmentHandling && $this->entityManager) {
/** @var string $html */
$html = preg_replace_callback(
'/\?entryPoint=attachment\&id=([A-Za-z0-9]*)/',
@@ -44,6 +44,7 @@ class TemplateRenderer
private ?User $user = null;
private ?Entity $entity = null;
private bool $skipRelations = false;
private bool $skipInlineAttachmentHandling = false;
private bool $applyAcl = false;
private bool $useUserTimezone = false;
private HtmlizerFactory $htmlizerFactory;
@@ -97,6 +98,12 @@ class TemplateRenderer
return $this;
}
public function setSkipInlineAttachmentHandling(bool $skipInlineAttachmentHandling = true): self
{
$this->skipInlineAttachmentHandling = $skipInlineAttachmentHandling;
return $this;
}
public function setApplyAcl(bool $applyAcl = true): self
{
$this->applyAcl = $applyAcl;
@@ -139,7 +146,8 @@ class TemplateRenderer
$template,
null,
$this->data,
$this->skipRelations
$this->skipRelations,
$this->skipInlineAttachmentHandling
);
}
@@ -174,6 +174,7 @@ class Invitations
$subjectTpl,
'invitation-email-subject-' . $entity->getEntityType(),
$data,
true,
true
);
@@ -182,7 +183,8 @@ class Invitations
$bodyTpl,
'invitation-email-body-' . $entity->getEntityType(),
$data,
false
false,
true
);
$email->set('subject', $subject);