Skip to content

Commit

Permalink
[TASK] Remove typoscript usages with old method
Browse files Browse the repository at this point in the history
  • Loading branch information
b13-michaelsemle committed Jun 28, 2024
1 parent 8078a05 commit 67dca8e
Show file tree
Hide file tree
Showing 4 changed files with 28 additions and 8 deletions.
9 changes: 7 additions & 2 deletions Classes/ViewHelpers/Link/ArchiveViewHelper.php
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@

namespace T3G\AgencyPack\Blog\ViewHelpers\Link;

use TYPO3\CMS\Core\TypoScript\FrontendTypoScript;
use TYPO3\CMS\Core\Utility\GeneralUtility;
use TYPO3\CMS\Extbase\Mvc\Web\Routing\UriBuilder;
use TYPO3\CMS\Frontend\Controller\TypoScriptFrontendController;
Expand Down Expand Up @@ -40,7 +41,9 @@ public function render(): string
$rssFormat = (bool)$this->arguments['rss'];
$year = (int)$this->arguments['year'];
$month = (int)$this->arguments['month'];
$pageUid = (int)$this->getTypoScriptFrontendController()->tmpl->setup['plugin.']['tx_blog.']['settings.']['archiveUid'];
/** @var FrontendTypoScript $typoscriptAttribute */
$typoscriptAttribute = $GLOBALS['TYPO3_REQUEST']->getAttribute('frontend.typoscript');
$pageUid = (int)$typoscriptAttribute->getSetupArray()['plugin.']['tx_blog.']['settings.']['archiveUid'];
$arguments = [
'year' => $year
];
Expand All @@ -52,8 +55,10 @@ public function render(): string
->setRequest($this->renderingContext->getRequest())
->setTargetPageUid($pageUid);
if ($rssFormat) {
/** @var FrontendTypoScript $typoscriptAttribute */
$typoscriptAttribute = $GLOBALS['TYPO3_REQUEST']->getAttribute('frontend.typoscript');
$uriBuilder
->setTargetPageType((int)$this->getTypoScriptFrontendController()->tmpl->setup['blog_rss_archive.']['typeNum']);
->setTargetPageType((int)$typoscriptAttribute->getSetupArray()['blog_rss_archive.']['typeNum']);
}
$uri = $uriBuilder->uriFor('listPostsByDate', $arguments, 'Post', 'Blog', 'Archive');
$linkText = $this->renderChildren() ?? implode('-', $arguments);
Expand Down
9 changes: 7 additions & 2 deletions 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\TypoScript\FrontendTypoScript;
use TYPO3\CMS\Core\Utility\GeneralUtility;
use TYPO3\CMS\Extbase\Mvc\Web\Routing\UriBuilder;
use TYPO3\CMS\Frontend\Controller\TypoScriptFrontendController;
Expand Down Expand Up @@ -56,7 +57,9 @@ protected function buildUriFromDetailsPage(Author $author, bool $rssFormat): str

protected function buildUriFromDefaultPage(Author $author, bool $rssFormat): string
{
$uriBuilder = $this->getUriBuilder((int)$this->getTypoScriptFrontendController()->tmpl->setup['plugin.']['tx_blog.']['settings.']['authorUid'], [], $rssFormat);
/** @var FrontendTypoScript $typoscriptAttribute */
$typoscriptAttribute = $GLOBALS['TYPO3_REQUEST']->getAttribute('frontend.typoscript');
$uriBuilder = $this->getUriBuilder((int)$typoscriptAttribute->getSetupArray()['plugin.']['tx_blog.']['settings.']['authorUid'], [], $rssFormat);
$arguments = [
'author' => $author->getUid(),
];
Expand All @@ -71,8 +74,10 @@ protected function getUriBuilder(int $pageUid, array $additionalParams, bool $rs
->setTargetPageUid($pageUid)
->setArguments($additionalParams);
if ($rssFormat) {
/** @var FrontendTypoScript $typoscriptAttribute */
$typoscriptAttribute = $GLOBALS['TYPO3_REQUEST']->getAttribute('frontend.typoscript');
$uriBuilder
->setTargetPageType((int)$this->getTypoScriptFrontendController()->tmpl->setup['blog_rss_author.']['typeNum']);
->setTargetPageType((int)$typoscriptAttribute->getSetupArray()['blog_rss_author.']['typeNum']);
}

return $uriBuilder;
Expand Down
9 changes: 7 additions & 2 deletions Classes/ViewHelpers/Link/CategoryViewHelper.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\Category;
use TYPO3\CMS\Core\TypoScript\FrontendTypoScript;
use TYPO3\CMS\Core\Utility\GeneralUtility;
use TYPO3\CMS\Extbase\Mvc\Web\Routing\UriBuilder;
use TYPO3\CMS\Frontend\Controller\TypoScriptFrontendController;
Expand Down Expand Up @@ -40,7 +41,9 @@ public function render(): string
$rssFormat = (bool)$this->arguments['rss'];
/** @var Category $category */
$category = $this->arguments['category'];
$pageUid = (int)$this->getTypoScriptFrontendController()->tmpl->setup['plugin.']['tx_blog.']['settings.']['categoryUid'];
/** @var FrontendTypoScript $typoscriptAttribute */
$typoscriptAttribute = $GLOBALS['TYPO3_REQUEST']->getAttribute('frontend.typoscript');
$pageUid = (int)$typoscriptAttribute->getSetupArray()['plugin.']['tx_blog.']['settings.']['categoryUid'];
$arguments = [
'category' => $category->getUid(),
];
Expand All @@ -49,8 +52,10 @@ public function render(): string
->setRequest($this->renderingContext->getRequest())
->setTargetPageUid($pageUid);
if ($rssFormat) {
/** @var FrontendTypoScript $typoscriptAttribute */
$typoscriptAttribute = $GLOBALS['TYPO3_REQUEST']->getAttribute('frontend.typoscript');
$uriBuilder
->setTargetPageType((int)$this->getTypoScriptFrontendController()->tmpl->setup['blog_rss_category.']['typeNum']);
->setTargetPageType((int)$typoscriptAttribute->getSetupArray()['blog_rss_category.']['typeNum']);
}
$uri = $uriBuilder->uriFor('listPostsByCategory', $arguments, 'Post', 'Blog', 'Category');

Expand Down
9 changes: 7 additions & 2 deletions Classes/ViewHelpers/Link/TagViewHelper.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\Tag;
use TYPO3\CMS\Core\TypoScript\FrontendTypoScript;
use TYPO3\CMS\Core\Utility\GeneralUtility;
use TYPO3\CMS\Extbase\Mvc\Web\Routing\UriBuilder;
use TYPO3\CMS\Frontend\Controller\TypoScriptFrontendController;
Expand Down Expand Up @@ -40,7 +41,9 @@ public function render(): string
$rssFormat = (bool)$this->arguments['rss'];
/** @var Tag $tag */
$tag = $this->arguments['tag'];
$pageUid = (int)$this->getTypoScriptFrontendController()->tmpl->setup['plugin.']['tx_blog.']['settings.']['tagUid'];
/** @var FrontendTypoScript $typoscriptAttribute */
$typoscriptAttribute = $GLOBALS['TYPO3_REQUEST']->getAttribute('frontend.typoscript');
$pageUid = (int)$typoscriptAttribute->getSetupArray()['plugin.']['tx_blog.']['settings.']['tagUid'];
$arguments = [
'tag' => $tag->getUid(),
];
Expand All @@ -49,8 +52,10 @@ public function render(): string
->setRequest($this->renderingContext->getRequest())
->setTargetPageUid($pageUid);
if ($rssFormat) {
/** @var FrontendTypoScript $typoscriptAttribute */
$typoscriptAttribute = $GLOBALS['TYPO3_REQUEST']->getAttribute('frontend.typoscript');
$uriBuilder
->setTargetPageType((int)$this->getTypoScriptFrontendController()->tmpl->setup['blog_rss_tag.']['typeNum']);
->setTargetPageType((int)$typoscriptAttribute->getSetupArray()['blog_rss_tag.']['typeNum']);
}
$uri = $uriBuilder->uriFor('listPostsByTag', $arguments, 'Post', 'Blog', 'Tag');
if ($uri !== '') {
Expand Down

0 comments on commit 67dca8e

Please sign in to comment.