Commit 3c275ff1 authored by Benni Mack's avatar Benni Mack Committed by Georg Ringer
Browse files

[!!!][TASK] Deprecate useCacheHash/noCacheHash

Having Site Handling in place, the option "useCacheHash"
rendered useless as it is added by TYPO3 Core automatically
when necessary with SiteHandling.

Any Fluid Arguments haven't been deprecated as this
was part of the the legacy functionality. Now the options
are still available, but trigger a deprecation message
that the option is superfluous and should be removed.

Calling typolink.useCacheHash will now trigger a
deprecation message.

Resolves: #88406
Releases: master
Change-Id: I2243a335188c3466b8f8f59e8d3e417f13bf854d
Reviewed-on: https://review.typo3.org/c/Packages/TYPO3.CMS/+/60774

Tested-by: default avatarTYPO3com <noreply@typo3.com>
Tested-by: Anja Leichsenring's avatarAnja Leichsenring <aleichsenring@ab-softlab.de>
Tested-by: Andreas Fernandez's avatarAndreas Fernandez <a.fernandez@scripting-base.de>
Tested-by: Georg Ringer's avatarGeorg Ringer <georg.ringer@gmail.com>
Reviewed-by: Anja Leichsenring's avatarAnja Leichsenring <aleichsenring@ab-softlab.de>
Reviewed-by: Andreas Fernandez's avatarAndreas Fernandez <a.fernandez@scripting-base.de>
Reviewed-by: Georg Ringer's avatarGeorg Ringer <georg.ringer@gmail.com>
parent 01626d64
......@@ -48,7 +48,6 @@ use TYPO3\CMS\Core\Utility\HttpUtility;
use TYPO3\CMS\Core\Utility\MathUtility;
use TYPO3\CMS\Core\Utility\PathUtility;
use TYPO3\CMS\Extbase\SignalSlot\Dispatcher;
use TYPO3\CMS\Frontend\Page\CacheHashCalculator;
use TYPO3\CMS\Frontend\Page\PageRepository;
/**
......@@ -860,15 +859,7 @@ class EditDocumentController
$linkParameters = array_replace($linkParameters, $additionalGetParameters);
}
if (!empty($previewConfiguration['useCacheHash'])) {
$cacheHashCalculator = GeneralUtility::makeInstance(CacheHashCalculator::class);
$fullLinkParameters = HttpUtility::buildQueryString(array_merge($linkParameters, ['id' => $previewPageId]), '&');
$cacheHashParameters = $cacheHashCalculator->getRelevantParameters($fullLinkParameters);
$linkParameters['cHash'] = $cacheHashCalculator->calculateCacheHash($cacheHashParameters);
} else {
$linkParameters['no_cache'] = 1;
}
$linkParameters['no_cache'] = 1;
return HttpUtility::buildQueryString($linkParameters, '&');
}
......
.. include:: ../../Includes.txt
====================================================================================
Deprecation: #88406 - setCacheHash/noCacheHash options in ViewHelpers and UriBuilder
====================================================================================
See :issue:`88406`
Description
===========
Various Fluid ViewHelpers regarding linking have arguments similar to which are not evaluated anymore:
- useCacheHash
- noCacheHash
Extbase's UriBuilder has the following options that have no effect anymore since the Site
Handling concept automatically detects when to a cHash argument is necessary.
- UriBuilder->setUseCacheHash()
- UriBuilder->getUseCacheHash()
Impact
======
Calling the UriBuilder methods will trigger a deprecation message.
Using the arguments noCacheHash/useCacheHash in the following ViewHelpers will
trigger a deprecation message:
- f:form
- f:link.action
- f:link.page
- f:link.typolink
- f:uri.action
- f:uri.page
- f:uri.typolink
- f:widget.link
- f:widget.uri
If the underlying TypoLink logic is accessed directly, it will trigger a deprecation message
if `.useCacheHash` is set - without any effect either.
Affected Installations
======================
Any TYPO3 installation with custom templates setting this argument in Fluid or extensions
using Extbase's UriBuilder in a custom fashion.
Migration
=========
Remove any usages within the Fluid templates or Extension code.
.. index:: Fluid, PHP-API, TypoScript, PartiallyScanned
......@@ -52,7 +52,6 @@ a decimal value between 0 and 1.
tx_extension_pi1.controller = News
tx_extension_pi1.action = detail
}
useCacheHash = 1
}
}
}
......
......@@ -111,11 +111,6 @@ class UriBuilder
*/
protected $noCache = false;
/**
* @var bool
*/
protected $useCacheHash = true;
/**
* @var string
*/
......@@ -446,7 +441,6 @@ class UriBuilder
/**
* by default FALSE; if TRUE, &no_cache=1 will be appended to the URI
* This overrules the useCacheHash setting
*
* @param bool $noCache
* @return \TYPO3\CMS\Extbase\Mvc\Web\Routing\UriBuilder the current UriBuilder to allow method chaining
......@@ -474,7 +468,7 @@ class UriBuilder
*/
public function setUseCacheHash($useCacheHash)
{
$this->useCacheHash = (bool)$useCacheHash;
trigger_error('Calling UriBuilder->setUseCacheHash() will be removed in TYPO3 v11.0. TYPO3 Core routing is taking care of handling this argument. Simply remove the line to avoid the notice.', E_USER_DEPRECATED);
return $this;
}
......@@ -483,7 +477,8 @@ class UriBuilder
*/
public function getUseCacheHash()
{
return $this->useCacheHash;
trigger_error('Calling UriBuilder->getUseCacheHash() will be removed in TYPO3 v11.0. TYPO3 Core routing is taking care of handling this argument. Simply remove the line to avoid the notice.', E_USER_DEPRECATED);
return true;
}
/**
......@@ -516,7 +511,6 @@ class UriBuilder
$this->targetPageUid = null;
$this->targetPageType = 0;
$this->noCache = false;
$this->useCacheHash = true;
$this->argumentPrefix = null;
return $this;
}
......@@ -616,7 +610,7 @@ class UriBuilder
/**
* Builds the URI, backend flavour
* The resulting URI is relative and starts with "index.php".
* The settings pageUid, pageType, noCache, useCacheHash & linkAccessRestrictedPages
* The settings pageUid, pageType, noCache & linkAccessRestrictedPages
* will be ignored in the backend.
*
* @return string The URI
......@@ -745,8 +739,6 @@ class UriBuilder
}
if ($this->noCache === true) {
$typolinkConfiguration['no_cache'] = 1;
} elseif ($this->useCacheHash) {
$typolinkConfiguration['useCacheHash'] = 1;
}
if ($this->section !== '') {
$typolinkConfiguration['section'] = $this->section;
......
......@@ -110,8 +110,7 @@ class UriBuilderTest extends UnitTestCase
->setLinkAccessRestrictedPages(true)
->setTargetPageUid(123)
->setTargetPageType(321)
->setNoCache(true)
->setUseCacheHash(false);
->setNoCache(true);
$this->assertEquals(['test' => 'arguments'], $this->uriBuilder->getArguments());
$this->assertEquals('testSection', $this->uriBuilder->getSection());
$this->assertEquals('testFormat', $this->uriBuilder->getFormat());
......@@ -125,7 +124,6 @@ class UriBuilderTest extends UnitTestCase
$this->assertEquals(123, $this->uriBuilder->getTargetPageUid());
$this->assertEquals(321, $this->uriBuilder->getTargetPageType());
$this->assertEquals(true, $this->uriBuilder->getNoCache());
$this->assertEquals(false, $this->uriBuilder->getUseCacheHash());
}
/**
......@@ -201,16 +199,6 @@ class UriBuilderTest extends UnitTestCase
$this->assertEquals($expectedArguments, $this->uriBuilder->getArguments());
}
/**
* @test
*/
public function uriForDoesNotDisableCacheHashForNonCacheableActions()
{
$this->mockExtensionService->expects($this->any())->method('isActionCacheable')->will($this->returnValue(false));
$this->uriBuilder->uriFor('someNonCacheableAction', [], 'SomeController', 'SomeExtension');
$this->assertTrue($this->uriBuilder->getUseCacheHash());
}
/**
* @test
*/
......@@ -572,7 +560,7 @@ class UriBuilderTest extends UnitTestCase
*/
public function resetSetsAllOptionsToTheirDefaultValue()
{
$this->uriBuilder->setArguments(['test' => 'arguments'])->setSection('testSection')->setFormat('someFormat')->setCreateAbsoluteUri(true)->setAddQueryString(true)->setArgumentsToBeExcludedFromQueryString(['test' => 'addQueryStringExcludeArguments'])->setAddQueryStringMethod(null)->setArgumentPrefix('testArgumentPrefix')->setLinkAccessRestrictedPages(true)->setTargetPageUid(123)->setTargetPageType(321)->setNoCache(true)->setUseCacheHash(false);
$this->uriBuilder->setArguments(['test' => 'arguments'])->setSection('testSection')->setFormat('someFormat')->setCreateAbsoluteUri(true)->setAddQueryString(true)->setArgumentsToBeExcludedFromQueryString(['test' => 'addQueryStringExcludeArguments'])->setAddQueryStringMethod(null)->setArgumentPrefix('testArgumentPrefix')->setLinkAccessRestrictedPages(true)->setTargetPageUid(123)->setTargetPageType(321)->setNoCache(true);
$this->uriBuilder->reset();
$this->assertEquals([], $this->uriBuilder->getArguments());
$this->assertEquals('', $this->uriBuilder->getSection());
......@@ -586,7 +574,6 @@ class UriBuilderTest extends UnitTestCase
$this->assertEquals(null, $this->uriBuilder->getTargetPageUid());
$this->assertEquals(0, $this->uriBuilder->getTargetPageType());
$this->assertEquals(false, $this->uriBuilder->getNoCache());
$this->assertEquals(true, $this->uriBuilder->getUseCacheHash());
}
/**
......@@ -596,7 +583,7 @@ class UriBuilderTest extends UnitTestCase
{
$GLOBALS['TSFE']->id = 123;
$this->uriBuilder->setTargetPageUid(321);
$expectedConfiguration = ['parameter' => 321, 'useCacheHash' => 1];
$expectedConfiguration = ['parameter' => 321];
$actualConfiguration = $this->uriBuilder->_call('buildTypolinkConfiguration');
$this->assertEquals($expectedConfiguration, $actualConfiguration);
}
......@@ -607,7 +594,7 @@ class UriBuilderTest extends UnitTestCase
public function buildTypolinkConfigurationUsesCurrentPageUidIfTargetPageUidIsNotSet()
{
$GLOBALS['TSFE']->id = 123;
$expectedConfiguration = ['parameter' => 123, 'useCacheHash' => 1];
$expectedConfiguration = ['parameter' => 123];
$actualConfiguration = $this->uriBuilder->_call('buildTypolinkConfiguration');
$this->assertEquals($expectedConfiguration, $actualConfiguration);
}
......@@ -619,7 +606,7 @@ class UriBuilderTest extends UnitTestCase
{
$this->uriBuilder->setTargetPageUid(123);
$this->uriBuilder->setArguments(['foo' => 'bar', 'baz' => ['extbase' => 'fluid']]);
$expectedConfiguration = ['parameter' => 123, 'useCacheHash' => 1, 'additionalParams' => '&foo=bar&baz%5Bextbase%5D=fluid'];
$expectedConfiguration = ['parameter' => 123, 'additionalParams' => '&foo=bar&baz%5Bextbase%5D=fluid'];
$actualConfiguration = $this->uriBuilder->_call('buildTypolinkConfiguration');
$this->assertEquals($expectedConfiguration, $actualConfiguration);
}
......@@ -631,7 +618,7 @@ class UriBuilderTest extends UnitTestCase
{
$this->uriBuilder->setTargetPageUid(123);
$this->uriBuilder->setAddQueryString(true);
$expectedConfiguration = ['parameter' => 123, 'addQueryString' => 1, 'useCacheHash' => 1];
$expectedConfiguration = ['parameter' => 123, 'addQueryString' => 1];
$actualConfiguration = $this->uriBuilder->_call('buildTypolinkConfiguration');
$this->assertEquals($expectedConfiguration, $actualConfiguration);
}
......@@ -644,7 +631,7 @@ class UriBuilderTest extends UnitTestCase
$this->uriBuilder->setTargetPageUid(123);
$this->uriBuilder->setAddQueryString(true);
$this->uriBuilder->setAddQueryStringMethod('GET,POST');
$expectedConfiguration = ['parameter' => 123, 'addQueryString' => 1, 'addQueryString.' => ['method' => 'GET,POST'], 'useCacheHash' => 1];
$expectedConfiguration = ['parameter' => 123, 'addQueryString' => 1, 'addQueryString.' => ['method' => 'GET,POST']];
$actualConfiguration = $this->uriBuilder->_call('buildTypolinkConfiguration');
$this->assertEquals($expectedConfiguration, $actualConfiguration);
}
......@@ -660,7 +647,7 @@ class UriBuilderTest extends UnitTestCase
$mockDomainObject2->_set('uid', '321');
$this->uriBuilder->setTargetPageUid(123);
$this->uriBuilder->setArguments(['someDomainObject' => $mockDomainObject1, 'baz' => ['someOtherDomainObject' => $mockDomainObject2]]);
$expectedConfiguration = ['parameter' => 123, 'useCacheHash' => 1, 'additionalParams' => '&someDomainObject=123&baz%5BsomeOtherDomainObject%5D=321'];
$expectedConfiguration = ['parameter' => 123, 'additionalParams' => '&someDomainObject=123&baz%5BsomeOtherDomainObject%5D=321'];
$actualConfiguration = $this->uriBuilder->_call('buildTypolinkConfiguration');
$this->assertEquals($expectedConfiguration, $actualConfiguration);
}
......@@ -683,7 +670,7 @@ class UriBuilderTest extends UnitTestCase
->with('SomeExtensionNameFromRequest', 'txt')
->will($this->returnValue(2));
$expectedConfiguration = ['parameter' => '123,2', 'useCacheHash' => 1];
$expectedConfiguration = ['parameter' => '123,2'];
$actualConfiguration = $this->uriBuilder->_call('buildTypolinkConfiguration');
$this->assertEquals($expectedConfiguration, $actualConfiguration);
}
......@@ -704,7 +691,7 @@ class UriBuilderTest extends UnitTestCase
->with(null, 'txt')
->will($this->returnValue(0));
$expectedConfiguration = ['parameter' => '123,0', 'useCacheHash' => 1];
$expectedConfiguration = ['parameter' => '123,0'];
$actualConfiguration = $this->uriBuilder->_call('buildTypolinkConfiguration');
$this->assertEquals($expectedConfiguration, $actualConfiguration);
......@@ -727,7 +714,7 @@ class UriBuilderTest extends UnitTestCase
->with(null, 'txt')
->will($this->returnValue(0));
$expectedConfiguration = ['parameter' => '123,0', 'useCacheHash' => 1];
$expectedConfiguration = ['parameter' => '123,0'];
$actualConfiguration = $this->uriBuilder->_call('buildTypolinkConfiguration');
$this->assertEquals($expectedConfiguration, $actualConfiguration);
......@@ -745,18 +732,6 @@ class UriBuilderTest extends UnitTestCase
$this->assertEquals($expectedConfiguration, $actualConfiguration);
}
/**
* @test
*/
public function buildTypolinkConfigurationDoesNotSetUseCacheHashOptionIfUseCacheHashIsDisabled()
{
$this->uriBuilder->setTargetPageUid(123);
$this->uriBuilder->setUseCacheHash(false);
$expectedConfiguration = ['parameter' => 123];
$actualConfiguration = $this->uriBuilder->_call('buildTypolinkConfiguration');
$this->assertEquals($expectedConfiguration, $actualConfiguration);
}
/**
* @test
*/
......@@ -764,7 +739,7 @@ class UriBuilderTest extends UnitTestCase
{
$this->uriBuilder->setTargetPageUid(123);
$this->uriBuilder->setSection('SomeSection');
$expectedConfiguration = ['parameter' => 123, 'useCacheHash' => 1, 'section' => 'SomeSection'];
$expectedConfiguration = ['parameter' => 123, 'section' => 'SomeSection'];
$actualConfiguration = $this->uriBuilder->_call('buildTypolinkConfiguration');
$this->assertEquals($expectedConfiguration, $actualConfiguration);
}
......@@ -776,7 +751,7 @@ class UriBuilderTest extends UnitTestCase
{
$this->uriBuilder->setTargetPageUid(123);
$this->uriBuilder->setLinkAccessRestrictedPages(true);
$expectedConfiguration = ['parameter' => 123, 'useCacheHash' => 1, 'linkAccessRestrictedPages' => 1];
$expectedConfiguration = ['parameter' => 123, 'linkAccessRestrictedPages' => 1];
$actualConfiguration = $this->uriBuilder->_call('buildTypolinkConfiguration');
$this->assertEquals($expectedConfiguration, $actualConfiguration);
}
......
......@@ -117,7 +117,8 @@ class FormViewHelper extends \TYPO3\CMS\Fluid\ViewHelpers\Form\AbstractFormViewH
$this->registerArgument('object', 'mixed', 'Object to use for the form. Use in conjunction with the "property" attribute on the sub tags');
$this->registerArgument('pageType', 'int', 'Target page type', false, 0);
$this->registerArgument('noCache', 'bool', 'set this to disable caching for the target page. You should not need this.', false, false);
$this->registerArgument('noCacheHash', 'bool', 'set this to suppress the cHash query parameter created by TypoLink. You should not need this.', false, false);
// @deprecated
$this->registerArgument('noCacheHash', 'bool', 'Deprecated: Set this to suppress the cHash query parameter created by TypoLink. You should not need this.', false, null);
$this->registerArgument('section', 'string', 'The anchor to be added to the action URI (only active if $actionUri is not set)', false, '');
$this->registerArgument('format', 'string', 'The requested format (e.g. ".html") of the target page (only active if $actionUri is not set)', false, '');
$this->registerArgument('additionalParams', 'array', 'additional action URI query parameters that won\'t be prefixed like $arguments (overrule $arguments) (only active if $actionUri is not set)', false, []);
......@@ -195,6 +196,10 @@ class FormViewHelper extends \TYPO3\CMS\Fluid\ViewHelpers\Form\AbstractFormViewH
if ($this->hasArgument('actionUri')) {
$formActionUri = $this->arguments['actionUri'];
} else {
if (isset($this->arguments['noCacheHash'])) {
trigger_error('Using the argument "noCacheHash" in <f:form> ViewHelper has no effect anymore. Remove the argument in your fluid template, as it will result in a fatal error.', E_USER_DEPRECATED);
}
$pageUid = (isset($this->arguments['pageUid']) && (int)$this->arguments['pageUid'] > 0) ? (int)$this->arguments['pageUid'] : null;
$uriBuilder = $this->renderingContext->getControllerContext()->getUriBuilder();
$formActionUri = $uriBuilder
......@@ -202,7 +207,6 @@ class FormViewHelper extends \TYPO3\CMS\Fluid\ViewHelpers\Form\AbstractFormViewH
->setTargetPageUid($pageUid)
->setTargetPageType($this->arguments['pageType'] ?? 0)
->setNoCache($this->arguments['noCache'] ?? false)
->setUseCacheHash(isset($this->arguments['noCacheHash']) ? !$this->arguments['noCacheHash'] : true)
->setSection($this->arguments['section'] ?? '')
->setCreateAbsoluteUri($this->arguments['absolute'] ?? false)
->setArguments(isset($this->arguments['additionalParams']) ? (array)$this->arguments['additionalParams'] : [])
......
......@@ -57,7 +57,8 @@ class ActionViewHelper extends AbstractTagBasedViewHelper
$this->registerArgument('pageUid', 'int', 'Target page. See TypoLink destination');
$this->registerArgument('pageType', 'int', 'Type of the target page. See typolink.parameter');
$this->registerArgument('noCache', 'bool', 'Set this to disable caching for the target page. You should not need this.');
$this->registerArgument('noCacheHash', 'bool', 'Set this to suppress the cHash query parameter created by TypoLink. You should not need this.');
// @deprecated
$this->registerArgument('noCacheHash', 'bool', 'Deprecated: Set this to suppress the cHash query parameter created by TypoLink. You should not need this.');
$this->registerArgument('section', 'string', 'The anchor to be added to the URI');
$this->registerArgument('format', 'string', 'The requested format, e.g. ".html');
$this->registerArgument('linkAccessRestrictedPages', 'bool', 'If set, links pointing to access restricted pages will still link to the page even though the page cannot be accessed.');
......@@ -74,6 +75,9 @@ class ActionViewHelper extends AbstractTagBasedViewHelper
*/
public function render()
{
if (isset($this->arguments['noCacheHash'])) {
trigger_error('Using the argument "noCacheHash" in <f:link.action> ViewHelper has no effect anymore. Remove the argument in your fluid template, as it will result in a fatal error.', E_USER_DEPRECATED);
}
$action = $this->arguments['action'];
$controller = $this->arguments['controller'];
$extensionName = $this->arguments['extensionName'];
......@@ -81,7 +85,6 @@ class ActionViewHelper extends AbstractTagBasedViewHelper
$pageUid = (int)$this->arguments['pageUid'] ?: null;
$pageType = (int)$this->arguments['pageType'];
$noCache = (bool)$this->arguments['noCache'];
$noCacheHash = (bool)$this->arguments['noCacheHash'];
$section = (string)$this->arguments['section'];
$format = (string)$this->arguments['format'];
$linkAccessRestrictedPages = (bool)$this->arguments['linkAccessRestrictedPages'];
......@@ -97,7 +100,6 @@ class ActionViewHelper extends AbstractTagBasedViewHelper
->setTargetPageUid($pageUid)
->setTargetPageType($pageType)
->setNoCache($noCache)
->setUseCacheHash(!$noCacheHash)
->setSection($section)
->setFormat($format)
->setLinkAccessRestrictedPages($linkAccessRestrictedPages)
......
......@@ -71,7 +71,8 @@ class PageViewHelper extends AbstractTagBasedViewHelper
$this->registerArgument('pageUid', 'int', 'Target page. See TypoLink destination');
$this->registerArgument('pageType', 'int', 'Type of the target page. See typolink.parameter');
$this->registerArgument('noCache', 'bool', 'Set this to disable caching for the target page. You should not need this.');
$this->registerArgument('noCacheHash', 'bool', 'Set this to suppress the cHash query parameter created by TypoLink. You should not need this.');
// @deprecated
$this->registerArgument('noCacheHash', 'bool', 'Deprecated: Set this to suppress the cHash query parameter created by TypoLink. You should not need this.', false);
$this->registerArgument('section', 'string', 'The anchor to be added to the URI');
$this->registerArgument('linkAccessRestrictedPages', 'bool', 'If set, links pointing to access restricted pages will still link to the page even though the page cannot be accessed.');
$this->registerArgument('additionalParams', 'array', 'Additional query parameters that won\'t be prefixed like $arguments (overrule $arguments)');
......@@ -86,10 +87,12 @@ class PageViewHelper extends AbstractTagBasedViewHelper
*/
public function render()
{
if (isset($this->arguments['noCacheHash'])) {
trigger_error('Using the argument "noCacheHash" in <f:link.page> ViewHelper has no effect anymore. Remove the argument in your fluid template, as it will result in a fatal error.', E_USER_DEPRECATED);
}
$pageUid = isset($this->arguments['pageUid']) ? (int)$this->arguments['pageUid'] : null;
$pageType = isset($this->arguments['pageType']) ? (int)$this->arguments['pageType'] : 0;
$noCache = isset($this->arguments['noCache']) ? (bool)$this->arguments['noCache'] : false;
$noCacheHash = isset($this->arguments['noCacheHash']) ? (bool)$this->arguments['noCacheHash'] : false;
$section = isset($this->arguments['section']) ? (string)$this->arguments['section'] : '';
$linkAccessRestrictedPages = isset($this->arguments['linkAccessRestrictedPages']) ? (bool)$this->arguments['linkAccessRestrictedPages'] : false;
$additionalParams = isset($this->arguments['additionalParams']) ? (array)$this->arguments['additionalParams'] : [];
......@@ -102,7 +105,6 @@ class PageViewHelper extends AbstractTagBasedViewHelper
->setTargetPageUid($pageUid)
->setTargetPageType($pageType)
->setNoCache($noCache)
->setUseCacheHash(!$noCacheHash)
->setSection($section)
->setLinkAccessRestrictedPages($linkAccessRestrictedPages)
->setArguments($additionalParams)
......
......@@ -76,7 +76,8 @@ class TypolinkViewHelper extends AbstractViewHelper
$this->registerArgument('title', 'string', '', false, '');
$this->registerArgument('additionalParams', 'string', '', false, '');
$this->registerArgument('additionalAttributes', 'array', '', false, []);
$this->registerArgument('useCacheHash', 'bool', '', false, false);
// @deprecated
$this->registerArgument('useCacheHash', 'bool', '', false, null);
$this->registerArgument('addQueryString', 'bool', '', false, false);
$this->registerArgument('addQueryStringMethod', 'string', '', false, 'GET');
$this->registerArgument('addQueryStringExclude', 'string', '', false, '');
......@@ -95,13 +96,15 @@ class TypolinkViewHelper extends AbstractViewHelper
*/
public static function renderStatic(array $arguments, \Closure $renderChildrenClosure, RenderingContextInterface $renderingContext)
{
if (isset($arguments['useCacheHash'])) {
trigger_error('Using the argument "useCacheHash" in <f:link.typolink> ViewHelper has no effect anymore. Remove the argument in your fluid template, as it will result in a fatal error.', E_USER_DEPRECATED);
}
$parameter = $arguments['parameter'] ?? '';
$target = $arguments['target'] ?? '';
$class = $arguments['class'] ?? '';
$title = $arguments['title'] ?? '';
$additionalParams = $arguments['additionalParams'] ?? '';
$additionalAttributes = $arguments['additionalAttributes'] ?? [];
$useCacheHash = $arguments['useCacheHash'] ?? false;
$addQueryString = $arguments['addQueryString'] ?? false;
$addQueryStringMethod = $arguments['addQueryStringMethod'] ?? 'GET';
$addQueryStringExclude = $arguments['addQueryStringExclude'] ?? '';
......@@ -130,7 +133,6 @@ class TypolinkViewHelper extends AbstractViewHelper
'typolink.' => [
'parameter' => $typolinkParameter,
'ATagParams' => $aTagParams,
'useCacheHash' => $useCacheHash,
'addQueryString' => $addQueryString,
'addQueryString.' => [
'method' => $addQueryStringMethod,
......
......@@ -47,8 +47,9 @@ class ActionViewHelper extends AbstractViewHelper
$this->registerArgument('pluginName', 'string', 'Target plugin. If empty, the current plugin name is used');
$this->registerArgument('pageUid', 'int', 'Target page. See TypoLink destination');
$this->registerArgument('pageType', 'int', 'Type of the target page. See typolink.parameter', false, 0);
$this->registerArgument('noCache', 'bool', 'Set this to disable caching for the target page. You should not need this.', false, false);
$this->registerArgument('noCacheHash', 'bool', 'Set this to suppress the cHash query parameter created by TypoLink. You should not need this.', false, false);
$this->registerArgument('noCache', 'bool', 'Set this to disable caching for the target page. You should not need this.', false, null);
// @deprecated
$this->registerArgument('noCacheHash', 'bool', 'Deprecated: Set this to suppress the cHash query parameter created by TypoLink. You should not need this.', false, null);
$this->registerArgument('section', 'string', 'The anchor to be added to the URI', false, '');
$this->registerArgument('format', 'string', 'The requested format, e.g. ".html', false, '');
$this->registerArgument('linkAccessRestrictedPages', 'bool', 'If set, links pointing to access restricted pages will still link to the page even though the page cannot be accessed.', false, false);
......@@ -70,7 +71,9 @@ class ActionViewHelper extends AbstractViewHelper
$pageUid = $arguments['pageUid'];
$pageType = $arguments['pageType'];
$noCache = $arguments['noCache'];
$noCacheHash = $arguments['noCacheHash'];
if (isset($arguments['noCacheHash'])) {
trigger_error('Using the argument "noCacheHash" in <f:uri.action> ViewHelper has no effect anymore. Remove the argument in your fluid template, as it will result in a fatal error.', E_USER_DEPRECATED);
}
$section = $arguments['section'];
$format = $arguments['format'];
$linkAccessRestrictedPages = $arguments['linkAccessRestrictedPages'];
......@@ -90,7 +93,6 @@ class ActionViewHelper extends AbstractViewHelper
->setTargetPageUid($pageUid)
->setTargetPageType($pageType)
->setNoCache($noCache)
->setUseCacheHash(!$noCacheHash)
->setSection($section)
->setFormat($format)
->setLinkAccessRestrictedPages($linkAccessRestrictedPages)
......
......@@ -58,7 +58,8 @@ class PageViewHelper extends AbstractViewHelper
$this->registerArgument('additionalParams', 'array', 'query parameters to be attached to the resulting URI', false, []);
$this->registerArgument('pageType', 'int', 'type of the target page. See typolink.parameter', false, 0);
$this->registerArgument('noCache', 'bool', 'set this to disable caching for the target page. You should not need this.', false, false);
$this->registerArgument('noCacheHash', 'bool', 'set this to suppress the cHash query parameter created by TypoLink. You should not need this.', false, false);
// @deprecated
$this->registerArgument('noCacheHash', 'bool', 'Deprecated: Set this to suppress the cHash query parameter created by TypoLink. You should not need this.', false, null);
$this->registerArgument('section', 'string', 'the anchor to be added to the URI', false, '');
$this->registerArgument('linkAccessRestrictedPages', 'bool', 'If set, links pointing to access restricted pages will still link to the page even though the page cannot be accessed.', false, false);
$this->registerArgument('absolute', 'bool', 'If set, the URI of the rendered link is absolute', false, false);
......@@ -79,7 +80,9 @@ class PageViewHelper extends AbstractViewHelper
$additionalParams = $arguments['additionalParams'];
$pageType = $arguments['pageType'];
$noCache = $arguments['noCache'];
$noCacheHash = $arguments['noCacheHash'];
if (isset($arguments['noCacheHash'])) {
trigger_error('Using the argument "noCacheHash" in <f:uri.page> ViewHelper has no effect anymore. Remove the argument in your fluid template, as it will result in a fatal error.', E_USER_DEPRECATED);
}
$section = $arguments['section'];
$linkAccessRestrictedPages = $arguments['linkAccessRestrictedPages'];
$absolute = $arguments['absolute'];
......@@ -88,7 +91,7 @@ class PageViewHelper extends AbstractViewHelper
$addQueryStringMethod = $arguments['addQueryStringMethod'];
$uriBuilder = $renderingContext->getControllerContext()->getUriBuilder();
$uri = $uriBuilder->setTargetPageUid($pageUid)->setTargetPageType($pageType)->setNoCache($noCache)->setUseCacheHash(!$noCacheHash)->setSection($section)->setLinkAccessRestrictedPages($linkAccessRestrictedPages)->setArguments($additionalParams)->setCreateAbsoluteUri($absolute)->setAddQueryString($addQueryString)->setArgumentsToBeExcludedFromQueryString($argumentsToBeExcludedFromQueryString)->setAddQueryStringMethod($addQueryStringMethod)->build();
$uri = $uriBuilder->setTargetPageUid($pageUid)->setTargetPageType($pageType)->setNoCache($noCache)->setSection($section)->setLinkAccessRestrictedPages($linkAccessRestrictedPages)->setArguments($additionalParams)->setCreateAbsoluteUri($absolute)->setAddQueryString($addQueryString)->setArgumentsToBeExcludedFromQueryString($argumentsToBeExcludedFromQueryString)->setAddQueryStringMethod($addQueryStringMethod)->build();
return $uri;
}
}
......@@ -40,7 +40,7 @@ use TYPO3Fluid\Fluid\Core\ViewHelper\Traits\CompileWithRenderStatic;
*
* Full parameter usage::
*
* <f:uri.typolink parameter="{link}" additionalParams="&u=b" useCacheHash="true" />
* <f:uri.typolink parameter="{link}" additionalParams="&u=b" />
*
* ``index.php?id=19&X=y&u=b``
*/
......@@ -55,7 +55,8 @@ class TypolinkViewHelper extends AbstractViewHelper
{
$this->registerArgument('parameter', 'string', 'stdWrap.typolink style parameter string', true);
$this->registerArgument('additionalParams', 'string', 'stdWrap.typolink additionalParams', false, '');
$this->registerArgument('useCacheHash', 'bool', '', false, false);
// @deprecated
$this->registerArgument('useCacheHash', 'bool', 'Deprecated: You should not need this.', false);
$this->registerArgument('addQueryString', 'bool', '', false, false);
$this->registerArgument('addQueryStringMethod', 'string', '', false, 'GET');
$this->registerArgument('addQueryStringExclude', 'string', '', false, '');
......@@ -71,9 +72,11 @@ class TypolinkViewHelper extends AbstractViewHelper
*/
public static function renderStatic(array $arguments, \Closure $renderChildrenClosure, RenderingContextInterface $renderingContext)
{
if (isset($arguments['useCacheHash'])) {
trigger_error('Using the argument "noCacheHash" in <f:uri.typolink> ViewHelper has no effect anymore. Remove the argument in your fluid template, as it will result in a fatal error.', E_USER_DEPRECATED);
}
$parameter = $arguments['parameter'];
$additionalParams = $arguments['additionalParams'];
$useCacheHash = $arguments['useCacheHash'];
$addQueryString = $arguments['addQueryString'];
$addQueryStringMethod = $arguments['addQueryStringMethod'];
$addQueryStringExclude = $arguments['addQueryStringExclude'];
......@@ -85,7 +88,6 @@ class TypolinkViewHelper extends AbstractViewHelper
$content = $contentObject->typoLink_URL(
[
'parameter' => self::createTypolinkParameterFromArguments($parameter, $additionalParams),
'useCacheHash' => $useCacheHash,
'addQueryString' => $addQueryString,
'addQueryString.' => [
'method' => $addQueryStringMethod,
......
......@@ -50,7 +50,8 @@ class LinkViewHelper extends AbstractTagBasedViewHelper
$this->registerTagAttribute('rel', 'string', 'Specifies the relationship between the current document and the linked document');
$this->registerTagAttribute('rev', 'string', 'Specifies the relationship between the linked document and the current document');
$this->registerTagAttribute('target', 'string', 'Specifies where to open the linked document');
$this->registerArgument('useCacheHash', 'bool', 'True whether the cache hash should be appended to the URL', false, false);
// @deprecated
$this->registerArgument('useCacheHash', 'bool', 'Deprecated: True whether the cache hash should be appended to the URL', false, null);
$this->registerArgument('addQueryStringMethod', 'string', 'Method to be used for query string');
$this->registerArgument('action', 'string', 'Target action');
$this->registerArgument('arguments', 'array', 'Arguments', false, []);
......@@ -114,10 +115,12 @@ class LinkViewHelper extends AbstractTagBasedViewHelper