Skip to content

Commit

Permalink
[TASK] Make MailContent compatible with v12 (#279)
Browse files Browse the repository at this point in the history
  • Loading branch information
benjaminkott authored May 26, 2023
1 parent 4a4e9be commit d8ef266
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 2 deletions.
13 changes: 13 additions & 0 deletions Classes/Domain/Model/Post.php
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,8 @@
use TYPO3\CMS\Extbase\Mvc\Web\Routing\UriBuilder;
use TYPO3\CMS\Extbase\Persistence\ObjectStorage;
use TYPO3\CMS\Extbase\Persistence\QueryResultInterface;
use TYPO3\CMS\Frontend\ContentObject\ContentObjectRenderer;
use TYPO3\CMS\Frontend\Typolink\LinkFactory;

class Post extends AbstractEntity
{
Expand Down Expand Up @@ -367,6 +369,17 @@ public function getCrdateYear(): int

public function getUri(): string
{
if (class_exists(LinkFactory::class)) {
return (string) GeneralUtility::makeInstance(LinkFactory::class)->create(
'',
[
'parameter' => (string) $this->getUid(),
'forceAbsoluteUrl' => true
],
GeneralUtility::makeInstance(ContentObjectRenderer::class)
)->getUrl();
}

return GeneralUtility::makeInstance(UriBuilder::class)
->setCreateAbsoluteUri(true)
->setTargetPageUid((int) $this->getUid())
Expand Down
1 change: 0 additions & 1 deletion Classes/Mail/MailContent.php
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,6 @@ protected function getFluidTemplateObject(string $template): StandaloneView
$view->setPartialRootPaths($settings['view']['emails']['partialRootPaths']);
$view->setTemplateRootPaths($settings['view']['emails']['templateRootPaths']);
$view->setTemplate($template);
$view->getRequest()->setControllerExtensionName('blog');

return $view;
}
Expand Down
2 changes: 1 addition & 1 deletion Resources/Private/Mails/Templates/CommentAdded.html
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
<f:section name="ContentSection">
<p>
<strong><f:translate key="email.label.post" extensionName="Blog" />: </strong>
<f:link.external uri="{post.uri}">{post.uri}</f:link.external>
<a href="{post.uri}" target="_blank">{post.uri}</a>
</p>
<p>
<strong><f:translate key="email.label.date" extensionName="Blog" />: </strong>
Expand Down

0 comments on commit d8ef266

Please sign in to comment.