Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 0 additions & 1 deletion Classes/ContentObject/TypoScriptRenderingContentObject.php
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,6 @@ class TypoScriptRenderingContentObject extends AbstractContentObject
*/
public function __construct(ContentObjectRenderer $cObj, RequestBuilder $requestBuilder = null, array $renderer = null)
{
parent::__construct($cObj);
$this->requestBuilder = $requestBuilder ?: new RequestBuilder();
$this->renderer = $renderer ?: $GLOBALS['TYPO3_CONF_VARS']['EXTCONF']['typoscript_rendering']['renderClasses'];
}
Expand Down
3 changes: 1 addition & 2 deletions Classes/Middleware/TypoScriptRenderingMiddleware.php
Original file line number Diff line number Diff line change
Expand Up @@ -40,10 +40,9 @@ public function process(ServerRequestInterface $request, RequestHandlerInterface
$frontendController = $GLOBALS['TSFE'];
$requestedContentType = $frontendController->config['config']['contentType'] ?? self::defaultContentType;
if (!$frontendController->isGeneratePage() || !isset($request->getQueryParams()[self::argumentNamespace])) {
return $this->amendContentType($handler->handle($request), $requestedContentType);
return $handler->handle($request);# $this->amendContentType(, $requestedContentType);
}
$this->ensureRequiredEnvironment();

$frontendController->config['config']['debug'] = 0;
$frontendController->config['config']['disableAllHeaderCode'] = 1;
$frontendController->config['config']['disableCharsetHeader'] = 0;
Expand Down
2 changes: 1 addition & 1 deletion Classes/Renderer/RecordRenderer.php
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,7 @@ protected function resolveRenderingConfiguration(Request $request, RenderingCont

if ($table === 'pages') {
// Allow rendering of a root page which has pid === 0 and would be denied otherwise
$rootLine = GeneralUtility::makeInstance(RootlineUtility::class, $id)->get();
$rootLine = GeneralUtility::makeInstance(RootlineUtility::class, (int)$id)->get();
// $rootLine[0] is the root page. Check if the page we're going to render is a root page.
// We explicitly ignore the case where the to be rendered id is in another root line (multi domain setup)
// as this would require an additional record lookup. The use case for this is very limited anyway
Expand Down
10 changes: 4 additions & 6 deletions Classes/Uri/TyposcriptRenderingUri.php
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@
use Helhum\TyposcriptRendering\Configuration\RecordRenderingConfigurationBuilder;
use Helhum\TyposcriptRendering\Renderer\RenderingContext;
use TYPO3\CMS\Core\Http\Uri;
use TYPO3\CMS\Core\Utility\GeneralUtility;
use TYPO3\CMS\Core\Utility\MathUtility;
use TYPO3\CMS\Fluid\Core\Widget\WidgetRequest;

Expand Down Expand Up @@ -49,8 +50,7 @@ public function withWidgetContext(ViewHelperContext $viewHelperContext): self
private function parseViewHelperContext(ViewHelperContext $viewHelperContext): void
{
$arguments = $viewHelperContext->getArguments();
$controllerContext = $viewHelperContext->getControllerContext();
$request = $controllerContext->getRequest();
$request = $viewHelperContext->getRequest();

$pluginName = $arguments['pluginName'] ?? null;
$extensionName = $arguments['extensionName'] ?? null;
Expand Down Expand Up @@ -81,7 +81,7 @@ private function parseViewHelperContext(ViewHelperContext $viewHelperContext): v
}
$additionalParams['tx_typoscriptrendering']['context'] = json_encode($renderingConfiguration);

$uriBuilder = $controllerContext->getUriBuilder();
$uriBuilder = GeneralUtility::makeInstance(\TYPO3\CMS\Extbase\Mvc\Web\Routing\UriBuilder::class);
$uriBuilder->reset();
if (is_callable([$uriBuilder, 'setUseCacheHash'])) {
$uriBuilder->setUseCacheHash(true);
Expand All @@ -93,7 +93,6 @@ private function parseViewHelperContext(ViewHelperContext $viewHelperContext): v
->setArguments($additionalParams)
->setCreateAbsoluteUri($arguments['absolute'] ?? false)
->setAddQueryString($arguments['addQueryString'] ?? false)
->setAddQueryStringMethod('GET')
->setArgumentsToBeExcludedFromQueryString($arguments['argumentsToBeExcludedFromQueryString'] ?? []);
if (MathUtility::canBeInterpretedAsInteger($arguments['pageUid'])) {
$uriBuilder->setTargetPageUid((int)$arguments['pageUid']);
Expand All @@ -115,7 +114,6 @@ private function parseWidgetContext(ViewHelperContext $viewHelperContext): void
{
$arguments = $viewHelperContext->getArguments();
$controllerContext = $viewHelperContext->getControllerContext();
/** @var $request WidgetRequest $request */
$request = $controllerContext->getRequest();
if (!$request instanceof WidgetRequest) {
throw new \RuntimeException('Called from wrong context', 1589401907);
Expand Down Expand Up @@ -202,7 +200,7 @@ private function buildConfigurationForPath(string $renderingPath, string $contex
return $configurationBuilder->configurationForPath($renderingPath, $contextRecordId);
}

protected function parseUri($uri, $removeControllerArgument = false)
protected function parseUri($uri, $removeControllerArgument = false): void
{
if ($removeControllerArgument) {
$uri = str_replace('&tx__%5Bcontroller%5D=Standard', '', $uri);
Expand Down
11 changes: 5 additions & 6 deletions Classes/Uri/ViewHelperContext.php
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
<?php
declare(strict_types=1);

namespace Helhum\TyposcriptRendering\Uri;

/*
Expand Down Expand Up @@ -45,14 +46,12 @@ public function __construct(RenderingContextInterface $renderingContext, array $
$this->configurationManager = $configurationManager;
}

public function getControllerContext(): ControllerContext

public function getRequest()
{
if ($this->renderingContext instanceof \TYPO3\CMS\Fluid\Core\Rendering\RenderingContext) {
return $this->renderingContext->getControllerContext();
return $this->renderingContext->getRequest();
}

// Let PHP deal with the error, we don't operate in other contexts anyway
return null;
}

public function getArguments(): array
Expand All @@ -62,7 +61,7 @@ public function getArguments(): array

public function getContentObject(): ContentObjectRenderer
{
$configurationManager = $this->configurationManager ?? GeneralUtility::makeInstance(ObjectManager::class)->get(ConfigurationManager::class);
$configurationManager = $this->configurationManager ?? GeneralUtility::makeInstance(ConfigurationManager::class);
$contentObject = $configurationManager->getContentObject();

return $contentObject ?? GeneralUtility::makeInstance(ContentObjectRenderer::class);
Expand Down
13 changes: 13 additions & 0 deletions Configuration/Services.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
services:
_defaults:
autowire: true
autoconfigure: true
public: false

Helhum\TyposcriptRendering\:
resource: '../Classes/*'

Helhum\TyposcriptRendering\ContentObject\TypoScriptRenderingContentObject:
tags:
- name: frontend.contentobject
identifier: 'TYPOSCRIPT_RENDERING'
3 changes: 0 additions & 3 deletions Migrations/Code/LegacyClassesForIde.php
Original file line number Diff line number Diff line change
@@ -1,7 +1,4 @@
<?php
namespace {
die('Access denied');
}
namespace Helhum\TyposcriptRendering\ViewHelpers\Uri {
/** @deprecated */
class AjaxActionViewHelper extends \Helhum\TyposcriptRendering\ViewHelpers\Uri\ActionViewHelper
Expand Down
2 changes: 1 addition & 1 deletion composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
"license": "GPL-2.0-or-later",
"require": {
"php": ">=7.2",
"typo3/cms-core": "^9.5.31 || ^10.4.2 || ^11.5.5"
"typo3/cms-core": "^12"
},
"require-dev": {
"nimut/testing-framework": "^6.0",
Expand Down
4 changes: 2 additions & 2 deletions ext_emconf.php
Original file line number Diff line number Diff line change
Expand Up @@ -10,11 +10,11 @@
'uploadfolder' => '0',
'createDirs' => '',
'clearCacheOnLoad' => 0,
'version' => '2.4.0',
'version' => '2.5.0',
'constraints' => [
'depends' => [
'php' => '7.2.0-8.999.999',
'typo3' => '9.5.31-11.5.99',
'typo3' => '12.4.0-12.4.99',
],
'conflicts' => [
],
Expand Down
1 change: 0 additions & 1 deletion ext_localconf.php
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
<?php
defined('TYPO3_MODE') or die();

(function () {
$GLOBALS['TYPO3_CONF_VARS']['FE']['ContentObjects']['TYPOSCRIPT_RENDERING'] = \Helhum\TyposcriptRendering\ContentObject\TypoScriptRenderingContentObject::class;
Expand Down