[TYPO3-mvc] Run ControllerAction inside a Hook with 4.5

Steffen Müller typo3 at t3node.com
Tue May 17 20:24:30 CEST 2011


Hi.

On 17.05.2011 18:48 Franz Koch wrote:
> that's also what I'd suggest to do. Simply only add the desired action
> to the switchableControllerActions configuration and you'r good to go.
>

So far, but how to add arguments for the action?

e.g. I have blog comments, which I approve in the backend. When 
approved, an e-mail should be sent to the comment author. This should be 
done with the emailAction (since it is also used in some other contexts)

My action is:
emailAction(Tx_Ext_Domain_model_Comment)

How do I tell the request to build a comment model object?

-----------------

My workaround is using fluid standalone:

$comment = $pObj->recordInfo($table, $id, '*');
$view = t3lib_div::makeInstance('Tx_Fluid_View_StandaloneView');
$templatePath = 
t3lib_div::getFileAbsFileName('EXT:ext/Resources/Private/Templates/Comment/Email.html');
$view->setTemplatePathAndFilename($templatePath);
$view->assign('myPid', '43');
$view->assign('comment', $comment);
$mailBody = $view->render();

The odrawback here is that link.page does not seem to work in hook context:
<f:link.page pageUid={myPid} absolute="1">Click here</f:link.page>
-->
<a href="http://www.example.com/mod.php?">Cick here</a>

Is it possible to set FE context somehow?

-- 
cheers,
Steffen

TYPO3 Blog: http://www.t3node.com/
Twitter: http://twitter.com/t3node


More information about the TYPO3-project-typo3v4mvc mailing list