[TYPO3-mvc] redirect in Tx_Extbase_MVC_Controller_AbstractController should respect the page typeNum
Marco Huber
marco.huber at marit.ag
Wed Feb 9 16:01:35 CET 2011
Hi everybody,
I think the redirect funtion in the class
Tx_Extbase_MVC_Controller_AbstractController should respect the page
typeNum.
As I don't know much about git here is the changed function:
public function redirect($actionName, $controllerName = NULL,
$extensionName = NULL, array $arguments = NULL, $pageUid = NULL, $delay
= 0, $statusCode = 303, $pageType = NULL){
if (!$this->request instanceof Tx_Extbase_MVC_Web_Request) throw new
Tx_Extbase_MVC_Exception_UnsupportedRequestType('redirect() only
supports web requests.', 1220539734);
if ($controllerName === NULL) {
$controllerName = $this->request->getControllerName();
}
if($pageType === NULL && $GLOBALS['TSFE']->type > 0){
$uri = $this->uriBuilder
->reset()
->setTargetPageUid($pageUid)
->setTargetPageType($GLOBALS['TSFE']->type)
->uriFor($actionName, $arguments, $controllerName, $extensionName);
} else {
$uri = $this->uriBuilder
->reset()
->setTargetPageUid($pageUid)
->uriFor($actionName, $arguments, $controllerName, $extensionName);
}
$this->redirectToURI($uri, $delay, $statusCode);
}
There is a new parameter $pageType so that you can specify the pageType
when you call the function. If $pageType is not defined the actuall
typeNum from the TSFE is taken.
I stumbled upon this problem when I wanted to call a page with a special
page type wich only has my plugin as content element in an ajax call.
Is there a better way to do that? Is this a bug or a feature?
Regards,
Marco
More information about the TYPO3-project-typo3v4mvc
mailing list