[TYPO3-mvc] HMENU userFunc & extbase

Franz Koch typo3.RemoveForMessage at elements-net.de
Wed Jun 23 18:06:09 CEST 2010


Hi,

> does someone here have experience using an extbase-Action as HMENU
> userFunc ?
> I get to the point that my action gets called, but if I return an array
> the menu always stays empty.
> I'm totally out of ideas here.

I had to modify the callActionMethod in my controller to be able to 
return non-string results. Try adding this method in your menu controller:

/**
  * Calls the specified action method and passes the arguments.
  *
  * If the action returns a string, it is appended to the content in the
  * response object. If the action doesn't return anything and a valid
  * view exists, the view is rendered automatically.
  *
  * @param string $actionMethodName Name of the action method to call
  * @return void
  * @api
  */
protected function callActionMethod() {
	$argumentsAreValid = TRUE;
	$preparedArguments = array();
	foreach ($this->arguments as $argument) {
		$preparedArguments[] = $argument->getValue();
	}

	if ($this->argumentsMappingResults->hasErrors()) {
		$actionResult = call_user_func(array($this, $this->errorMethodName));
	} else {
		$actionResult = call_user_func_array(array($this, 
$this->actionMethodName), $preparedArguments);
	}
	if ($actionResult === NULL && $this->view instanceof 
Tx_Extbase_MVC_View_ViewInterface) {
		$this->response->appendContent($this->view->render());
	} elseif (is_string($actionResult) && strlen($actionResult) > 0) {
		$this->response->appendContent($actionResult);
	} else if ($actionResult) {
		$this->response->setContent($actionResult);
	}
}


-- 
kind regards,
Franz Koch


More information about the TYPO3-project-typo3v4mvc mailing list