mirror of
https://github.com/espocrm/espocrm.git
synced 2026-06-28 06:56:05 +00:00
htmlizer: remove cacheId argument
This commit is contained in:
@@ -282,8 +282,8 @@ class Util
|
||||
'code' => $code,
|
||||
];
|
||||
|
||||
$subject = $htmlizer->render($user, $subjectTpl, null, $data, true);
|
||||
$body = $htmlizer->render($user, $bodyTpl, null, $data, true);
|
||||
$subject = $htmlizer->render($user, $subjectTpl, $data, true);
|
||||
$body = $htmlizer->render($user, $bodyTpl, $data, true);
|
||||
|
||||
$email = $this->emailFactory->create();
|
||||
|
||||
|
||||
@@ -93,7 +93,6 @@ class Htmlizer
|
||||
/**
|
||||
* Generate an HTML for entity by a given template.
|
||||
*
|
||||
* @param ?string $cacheId @deprecated To be skipped.
|
||||
* @param ?array<string, mixed> $additionalData Data will be passed to the template.
|
||||
* @param bool $skipLinks Do not process related records.
|
||||
* @internal
|
||||
@@ -101,19 +100,16 @@ class Htmlizer
|
||||
public function render(
|
||||
?Entity $entity,
|
||||
string $template,
|
||||
?string $cacheId = null,
|
||||
?array $additionalData = null,
|
||||
bool $skipLinks = false,
|
||||
bool $skipInlineAttachmentHandling = false
|
||||
bool $skipInlineAttachmentHandling = false,
|
||||
): string {
|
||||
|
||||
$helpers = $this->getHelpers();
|
||||
|
||||
$template = $this->prepare($template, array_keys($helpers));
|
||||
|
||||
$options = new Options(
|
||||
helpers: $helpers,
|
||||
);
|
||||
$options = new Options(helpers: $helpers);
|
||||
|
||||
$renderer = Handlebars::compile($template, $options);
|
||||
|
||||
|
||||
@@ -144,7 +144,6 @@ class TemplateRenderer
|
||||
return $htmlizer->render(
|
||||
$this->entity,
|
||||
$template,
|
||||
null,
|
||||
$this->data,
|
||||
$this->skipRelations,
|
||||
$this->skipInlineAttachmentHandling
|
||||
|
||||
@@ -129,7 +129,6 @@ class Invitations
|
||||
$subject = $htmlizer->render(
|
||||
$entity,
|
||||
$subjectTpl,
|
||||
"$type-email-subject-{$entity->getEntityType()}",
|
||||
$data,
|
||||
true,
|
||||
true
|
||||
@@ -138,7 +137,6 @@ class Invitations
|
||||
$body = $htmlizer->render(
|
||||
$entity,
|
||||
$bodyTpl,
|
||||
"$type-email-body-{$entity->getEntityType()}",
|
||||
$data,
|
||||
false,
|
||||
true
|
||||
|
||||
@@ -143,7 +143,6 @@ class EmailReminder
|
||||
$subject = $htmlizer->render(
|
||||
$entity,
|
||||
$subjectTpl,
|
||||
'reminder-email-subject-' . $entityType,
|
||||
$data,
|
||||
true
|
||||
);
|
||||
@@ -151,7 +150,6 @@ class EmailReminder
|
||||
$body = $htmlizer->render(
|
||||
$entity,
|
||||
$bodyTpl,
|
||||
'reminder-email-body-' . $entityType,
|
||||
$data,
|
||||
false
|
||||
);
|
||||
|
||||
@@ -157,19 +157,17 @@ class AssignmentProcessor
|
||||
$templateData['entityTypeLowerFirst'] = Util::mbLowerCaseFirst($templateData['entityType']);
|
||||
|
||||
$subject = $this->getHtmlizer()->render(
|
||||
$entity,
|
||||
$subjectTpl,
|
||||
'assignment-email-subject-' . $entity->getEntityType(),
|
||||
$templateData,
|
||||
true
|
||||
entity: $entity,
|
||||
template: $subjectTpl,
|
||||
additionalData: $templateData,
|
||||
skipLinks: true
|
||||
);
|
||||
|
||||
$body = $this->getHtmlizer()->render(
|
||||
$entity,
|
||||
$bodyTpl,
|
||||
'assignment-email-body-' . $entity->getEntityType(),
|
||||
$templateData,
|
||||
true
|
||||
entity: $entity,
|
||||
template: $bodyTpl,
|
||||
additionalData: $templateData,
|
||||
skipLinks: true
|
||||
);
|
||||
|
||||
$email->set([
|
||||
|
||||
@@ -336,8 +336,8 @@ class Processor
|
||||
|
||||
$subjectTpl = str_replace(["\n", "\r"], '', $subjectTpl);
|
||||
|
||||
$subject = $this->getHtmlizer()->render($note, $subjectTpl, 'mention-email-subject', $data, true);
|
||||
$body = $this->getHtmlizer()->render($note, $bodyTpl, 'mention-email-body', $data, true);
|
||||
$subject = $this->getHtmlizer()->render($note, $subjectTpl, $data, true);
|
||||
$body = $this->getHtmlizer()->render($note, $bodyTpl, $data, true);
|
||||
|
||||
$email = $this->entityManager->getRDBRepositoryByClass(Email::class)->getNew();
|
||||
|
||||
@@ -517,7 +517,6 @@ class Processor
|
||||
$subject = $this->getHtmlizer()->render(
|
||||
$note,
|
||||
$subjectTpl,
|
||||
'note-post-email-subject-' . $parentType,
|
||||
$data,
|
||||
true
|
||||
);
|
||||
@@ -525,7 +524,6 @@ class Processor
|
||||
$body = $this->getHtmlizer()->render(
|
||||
$note,
|
||||
$bodyTpl,
|
||||
'note-post-email-body-' . $parentType,
|
||||
$data,
|
||||
true
|
||||
);
|
||||
@@ -537,8 +535,8 @@ class Processor
|
||||
|
||||
$subjectTpl = str_replace(["\n", "\r"], '', $subjectTpl);
|
||||
|
||||
$subject = $this->getHtmlizer()->render($note, $subjectTpl, 'note-post-email-subject', $data, true);
|
||||
$body = $this->getHtmlizer()->render($note, $bodyTpl, 'note-post-email-body', $data, true);
|
||||
$subject = $this->getHtmlizer()->render($note, $subjectTpl, $data, true);
|
||||
$body = $this->getHtmlizer()->render($note, $bodyTpl, $data, true);
|
||||
}
|
||||
|
||||
/** @var Email $email */
|
||||
@@ -684,7 +682,6 @@ class Processor
|
||||
$subject = $this->getHtmlizer()->render(
|
||||
entity: $note,
|
||||
template: $subjectTpl,
|
||||
cacheId: 'note-status-email-subject',
|
||||
additionalData: $data,
|
||||
skipLinks: true,
|
||||
);
|
||||
@@ -692,7 +689,6 @@ class Processor
|
||||
$body = $this->getHtmlizer()->render(
|
||||
entity: $note,
|
||||
template: $bodyTpl,
|
||||
cacheId: 'note-status-email-body',
|
||||
additionalData: $data,
|
||||
skipLinks: true,
|
||||
);
|
||||
@@ -818,7 +814,6 @@ class Processor
|
||||
$subject = $this->getHtmlizer()->render(
|
||||
$note,
|
||||
$subjectTpl,
|
||||
'note-email-received-email-subject-' . $parentType,
|
||||
$data,
|
||||
true
|
||||
);
|
||||
@@ -826,7 +821,6 @@ class Processor
|
||||
$body = $this->getHtmlizer()->render(
|
||||
$note,
|
||||
$bodyTpl,
|
||||
'note-email-received-email-body-' . $parentType,
|
||||
$data,
|
||||
true
|
||||
);
|
||||
|
||||
@@ -91,7 +91,7 @@ class Processor
|
||||
}
|
||||
|
||||
if ($handlebarsInBody) {
|
||||
$body = $htmlizer->render($parent, $body, null, null, false, true);
|
||||
$body = $htmlizer->render($parent, $body, null, false, true);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -435,8 +435,8 @@ class RecoveryService
|
||||
|
||||
$htmlizer = $this->htmlizerFactory->create(true);
|
||||
|
||||
$subject = $htmlizer->render($user, $subjectTpl, null, $data, true);
|
||||
$body = $htmlizer->render($user, $bodyTpl, null, $data, true);
|
||||
$subject = $htmlizer->render($user, $subjectTpl, $data, true);
|
||||
$body = $htmlizer->render($user, $bodyTpl, $data, true);
|
||||
|
||||
$email
|
||||
->setSubject($subject)
|
||||
|
||||
@@ -80,8 +80,8 @@ class Sender
|
||||
|
||||
$htmlizer = $this->htmlizerFactory->createNoAcl();
|
||||
|
||||
$subject = $htmlizer->render($user, $subjectTpl ?? '', null, $data, true);
|
||||
$body = $htmlizer->render($user, $bodyTpl ?? '', null, $data, true);
|
||||
$subject = $htmlizer->render($user, $subjectTpl ?? '', $data, true);
|
||||
$body = $htmlizer->render($user, $bodyTpl ?? '', $data, true);
|
||||
|
||||
$email
|
||||
->addToAddress($emailAddress)
|
||||
@@ -121,8 +121,8 @@ class Sender
|
||||
|
||||
$htmlizer = $this->htmlizerFactory->createNoAcl();
|
||||
|
||||
$subject = $htmlizer->render($user, $subjectTpl ?? '', null, $data, true);
|
||||
$body = $htmlizer->render($user, $bodyTpl ?? '', null, $data, true);
|
||||
$subject = $htmlizer->render($user, $subjectTpl ?? '', $data, true);
|
||||
$body = $htmlizer->render($user, $bodyTpl ?? '', $data, true);
|
||||
|
||||
$email
|
||||
->setSubject($subject)
|
||||
|
||||
@@ -191,7 +191,7 @@ class HtmlizerTest extends TestCase
|
||||
|
||||
$template = "{{file name}}";
|
||||
$entity->set('name', '1');
|
||||
$html = $this->htmlizer->render($entity, $template, skipInlineAttachmentHandling: true);
|
||||
$html = $this->htmlizer->render($entity, $template, null, false, skipInlineAttachmentHandling: true);
|
||||
$this->assertEquals('?entryPoint=attachment&id=1', $html);
|
||||
|
||||
$template = "{{#ifEqual name '1'}}hello{{/ifEqual}}";
|
||||
@@ -224,7 +224,7 @@ class HtmlizerTest extends TestCase
|
||||
/** @noinspection HtmlUnknownAttribute */
|
||||
$template = "<ul><li iterate=\"{{items}}\">{{name}}</li></ul><ul><li iterate=\"{{items}}\">{{name}}</li></ul>";
|
||||
|
||||
$html = $this->htmlizer->render(null, $template, null, [
|
||||
$html = $this->htmlizer->render(null, $template, [
|
||||
'items' => [
|
||||
['name' => '1'],
|
||||
['name' => '2'],
|
||||
@@ -243,7 +243,7 @@ class HtmlizerTest extends TestCase
|
||||
$template = "<ul><li x-if=\"{{and (equal 1 1) true}}\">1</li><li x-if=\"{{false}}\">2</li>".
|
||||
"<li x-if=\"{{1}}\">true</li></ul>";
|
||||
|
||||
$html = $this->htmlizer->render(null, $template, null, []);
|
||||
$html = $this->htmlizer->render(null, $template, []);
|
||||
|
||||
/** @noinspection HtmlUnknownAttribute */
|
||||
$expected = "<ul><li>1</li><li>true</li></ul>";
|
||||
|
||||
Reference in New Issue
Block a user