Page::getActionLink()
\nn\t3::Page()->getActionLink($pid = NULL, $extensionName = '', $pluginName = '', $controllerName = '', $actionName = '', $params = [], $absolute = false);
Get link to an action / controller
\nn\t3::Page()->getActionLink( $pid, $extName, $pluginName, $controllerName, $actionName, $args );
Copied!
Example for the news extension:
$newsArticleUid = 45;
$newsDetailPid = 123;
\nn\t3::Page()->getActionLink( $newsDetailPid, 'news', 'pi1', 'News', 'detail', ['news'=>$newsArticleUid]);
Copied!
| @return string
Source Code
public function getActionLink( $pid = null, $extensionName = '', $pluginName = '', $controllerName = '', $actionName = '', $params = [], $absolute = false ) {
$extensionService = GeneralUtility::makeInstance(\TYPO3\CMS\Extbase\Service\ExtensionService::class);
$argumentsPrefix = $extensionService->getPluginNamespace($extensionName, $pluginName);
$arguments = [
$argumentsPrefix => [
'action' => $actionName,
'controller' => $controllerName,
],
];
$arguments[$argumentsPrefix] = array_merge($arguments[$argumentsPrefix], $params);
return $this->getLink( $pid, $arguments, $absolute );
}
Copied!