Any idea how to solve this? I have an extbase plugin, that has a list and a show action. Both should be cachable and the detail link should not contain a cache hash
I can not achieve this. As soon as i enable the caches i always get the same result for the detail action.
I configured the plugin to be cacheable:
// add detail plugin
\TYPO3\CMS\Extbase\Utility\ExtensionUtility::configurePlugin(
'Vendor.Extension',
'SomePiName',
[
'ControllerName' => 'show',
],
[],
\TYPO3\CMS\Extbase\Utility\ExtensionUtility::PLUGIN_TYPE_CONTENT_ELEMENT
);
The routing config:
routeEnhancers:
MyEnhanceName:
type: Extbase
extension: Extension
plugin: SomePiName
routes:
- { routePath: '/{localized_entry}/{slug}', _controller: 'ControllerName::show', _arguments: {'slug': 'uuid'} }
defaultController: 'ControllerName::show'
aspects:
localized_entry:
type: LocaleModifier
default: 'show'
localeMap:
- locale: 'de_DE.*|de_AT.*|de_CH.*'
value: 'detail'
- locale: 'it_IT.*'
value: 'dettaglio'
slug:
type: customType
My custom aspect works by mapping the foreign uuid on a generated slug, that is stored in a mysql-table i maintain.
I want a deeplink like:
/path/to/page/show/here-comes-the-slug
But i get
/path/to/page/show/here-comes-the-slug?cHash=...
So i added:
$GLOBALS['TYPO3_CONF_VARS']['FE']['cacheHash']['excludedParameters'][] = "tx_extension_somepiname[uuid]";
$GLOBALS['TYPO3_CONF_VARS']['FE']['cacheHash']['excludedParameters'][] = "tx_extension_somepiname[controller]";
$GLOBALS['TYPO3_CONF_VARS']['FE']['cacheHash']['excludedParameters'][] = "tx_extension_somepiname[action]";
Now the link looks like:
/path/to/page/show/here-comes-the-slug
But as soon as i activate the caches i always get the same result.
So i need a cache hash calculation but i dont want the fu**er to be in the link...
Links are generated using ContentObjectRenderer->typolink_URL with the config:
[
"parameter" => "t3://myhandler?uuid=someuuid"
]
that handler translates to a subsequent call to ContentObjectRenderer->typolink_URL with the config:
[
"parameter" => "t3://page?uid=someconfiguredpageuid",
"useCacheHash" => 0,
"additionalParams" => "&tx_extension_somepiname[uuid]=uuid&tx_extension_somepiname[controller]=Controller&tx_extension_somepiname[action]=show"
]
So my situation is, that i can EITHER have a cacheHash and a correct result OR nor cacheHash with invalid results.
How is this meant to be done?
Okay, i solved this, here the necessary steps:
1) Like Jonas Eberle suggested we remove the extbase arguments from excludedParameters.
2) Configure the details action as cacheable (remove controller->action combination from 2nd array of possible actions in extbase plugin registration / ext_localconf.php)
3) When using a custom aspect, implement the "StaticMappableAspectInterface". I did not find the relevant part in the core but it seems this interface is required! Just have a look at the PersistedAliasMapper.
Now it works...