Skip to content

Commit

Permalink
[BUGFIX] Avoid $this->renderingContext->getControllerContext()->getUr…
Browse files Browse the repository at this point in the history
…iBuilder()
  • Loading branch information
benjaminkott committed May 10, 2023
1 parent cedcb1c commit b9aa130
Show file tree
Hide file tree
Showing 5 changed files with 14 additions and 5 deletions.
4 changes: 3 additions & 1 deletion Classes/ViewHelpers/Link/ArchiveViewHelper.php
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,8 @@

namespace T3G\AgencyPack\Blog\ViewHelpers\Link;

use TYPO3\CMS\Core\Utility\GeneralUtility;
use TYPO3\CMS\Extbase\Mvc\Web\Routing\UriBuilder;
use TYPO3Fluid\Fluid\Core\ViewHelper\AbstractTagBasedViewHelper;

class ArchiveViewHelper extends AbstractTagBasedViewHelper
Expand Down Expand Up @@ -44,7 +46,7 @@ public function render(): string
if ($month > 0) {
$arguments['month'] = $month;
}
$uriBuilder = $this->renderingContext->getControllerContext()->getUriBuilder();
$uriBuilder = GeneralUtility::makeInstance(UriBuilder::class);
$uriBuilder->reset()
->setTargetPageUid($pageUid);
if ($rssFormat) {
Expand Down
3 changes: 2 additions & 1 deletion Classes/ViewHelpers/Link/AuthorViewHelper.php
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
namespace T3G\AgencyPack\Blog\ViewHelpers\Link;

use T3G\AgencyPack\Blog\Domain\Model\Author;
use TYPO3\CMS\Core\Utility\GeneralUtility;
use TYPO3\CMS\Extbase\Mvc\Web\Routing\UriBuilder;
use TYPO3Fluid\Fluid\Core\ViewHelper\AbstractTagBasedViewHelper;

Expand Down Expand Up @@ -80,7 +81,7 @@ protected function buildUriFromDefaultPage(Author $author, bool $rssFormat)
protected function getUriBuilder(int $pageUid, array $additionalParams, bool $rssFormat): UriBuilder
{
/** @var UriBuilder $uriBuilder */
$uriBuilder = $this->renderingContext->getControllerContext()->getUriBuilder();
$uriBuilder = GeneralUtility::makeInstance(UriBuilder::class);
$uriBuilder->reset()
->setTargetPageUid($pageUid)
->setArguments($additionalParams);
Expand Down
4 changes: 3 additions & 1 deletion Classes/ViewHelpers/Link/CategoryViewHelper.php
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,8 @@
namespace T3G\AgencyPack\Blog\ViewHelpers\Link;

use T3G\AgencyPack\Blog\Domain\Model\Category;
use TYPO3\CMS\Core\Utility\GeneralUtility;
use TYPO3\CMS\Extbase\Mvc\Web\Routing\UriBuilder;
use TYPO3Fluid\Fluid\Core\ViewHelper\AbstractTagBasedViewHelper;

class CategoryViewHelper extends AbstractTagBasedViewHelper
Expand Down Expand Up @@ -41,7 +43,7 @@ public function render(): string
$arguments = [
'category' => $category->getUid(),
];
$uriBuilder = $this->renderingContext->getControllerContext()->getUriBuilder();
$uriBuilder = GeneralUtility::makeInstance(UriBuilder::class);
$uriBuilder->reset()
->setTargetPageUid($pageUid);
if ($rssFormat) {
Expand Down
4 changes: 3 additions & 1 deletion Classes/ViewHelpers/Link/PostViewHelper.php
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,8 @@
namespace T3G\AgencyPack\Blog\ViewHelpers\Link;

use T3G\AgencyPack\Blog\Domain\Model\Post;
use TYPO3\CMS\Core\Utility\GeneralUtility;
use TYPO3\CMS\Extbase\Mvc\Web\Routing\UriBuilder;
use TYPO3Fluid\Fluid\Core\ViewHelper\AbstractTagBasedViewHelper;

class PostViewHelper extends AbstractTagBasedViewHelper
Expand Down Expand Up @@ -41,7 +43,7 @@ public function render(): string
$post = $this->arguments['post'];
$section = $this->arguments['section'] ?? '';
$pageUid = (int) $post->getUid();
$uriBuilder = $this->renderingContext->getControllerContext()->getUriBuilder();
$uriBuilder = GeneralUtility::makeInstance(UriBuilder::class);
$createAbsoluteUri = (bool)$this->arguments['createAbsoluteUri'];
$uri = $uriBuilder->reset()
->setTargetPageUid($pageUid)
Expand Down
4 changes: 3 additions & 1 deletion Classes/ViewHelpers/Link/TagViewHelper.php
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,8 @@
namespace T3G\AgencyPack\Blog\ViewHelpers\Link;

use T3G\AgencyPack\Blog\Domain\Model\Tag;
use TYPO3\CMS\Core\Utility\GeneralUtility;
use TYPO3\CMS\Extbase\Mvc\Web\Routing\UriBuilder;
use TYPO3Fluid\Fluid\Core\ViewHelper\AbstractTagBasedViewHelper;

class TagViewHelper extends AbstractTagBasedViewHelper
Expand Down Expand Up @@ -41,7 +43,7 @@ public function render(): string
$arguments = [
'tag' => $tag->getUid(),
];
$uriBuilder = $this->renderingContext->getControllerContext()->getUriBuilder();
$uriBuilder = GeneralUtility::makeInstance(UriBuilder::class);
$uriBuilder->reset()
->setTargetPageUid($pageUid);
if ($rssFormat) {
Expand Down

0 comments on commit b9aa130

Please sign in to comment.