[TYPO3-mvc] Generating a link to a backend-module / action

Tolleiv.Nietsch info at tolleiv.de
Thu Nov 18 18:12:46 CET 2010


Hi,

the code for generating a link to our module is one thing in the 
workspace-extension which I'm not proud of, but I wasn't able to find a 
better way to do it.

The code looks like:

$ctrl = 
t3lib_div::makeInstance('Tx_Workspaces_Controller_PreviewController');
$uriBuilder = 
t3lib_div::makeInstance('Tx_Extbase_MVC_Web_Routing_UriBuilder');
$additionalParams = 
'&tx_workspaces_web_workspacesworkspaces%5Bcontroller%5D=Preview&M=web_WorkspacesWorkspaces&id=';
$viewScript = '/' . $GLOBALS['BACK_PATH'] . $uriBuilder->uriFor('index', 
array(), $ctrl, 'workspaces', 'web_workspacesworkspaces') . 
$additionalParams;

You can find this code in EXT:workspaces/Classes/Service/Befunc.php, 
which is triggered from a hook in t3lib_beFunc::viewOnClick - so we're 
no within the extbase/fluid "stack".

These calls seem to be quite some overhead to me just to generate a link 
to our module. Instantiating the entire controller just to be able to 
generate the link and the amount of additional parameters, this can't be 
right.

It would be great if anyone of you could enlighten me and tell me how to 
link to our module from outside of the extbase/fluid "stack" without 
causing such an overhead.

Cheers,
Tolleiv
-- 
Tolleiv Nietsch
www.tolleiv.de - www.aoemedia.de
Twitter: http://www.twitter.com/tolleiv


More information about the TYPO3-project-typo3v4mvc mailing list