[TYPO3-mvc] Conceptual problem with BE modules

Xavier Perseguers typo3 at perseguers.ch
Sun Oct 25 09:56:28 CET 2009


Hi,

I think I'm facing a conceptual problem in regards to BE modules but that may certainly be "easily" fixed.

I'm currently working on function menu which is a standard feature of all scbase modules.

I was investigating how old-school modules are able to remember which function menu was active when we use another module and then go back to it. Instead of using default controller/action (which we 
have in our case), the module reuses last use function menu.

There is a few points. AFAIK we are missing the menuConfig() method of scbase modules that allows the module to prepare what will be the available functions *before* the "action" is being invoked (in 
case of scbase modules, the action is the method "main").

If we read code from typo3/mod.php which dispatches all backend request, we see the code we managed to add to Core to be able to dispatch to Extbase modules. If we have a closer look to what happens 
for a scbase module, the index.php file of the module is loaded and at the end, after the class declaration, is being instantiated like this (RealURL here):

// Make instance:
$SOBE = t3lib_div::makeInstance('tx_realurl_module1');
$SOBE->init();

// Include files?
foreach($SOBE->include_once as $INC_FILE) {
	@include_once($INC_FILE);
}

$SOBE->main();
$SOBE->printContent();

While for Extbase modules, we basically have the module name (OK) and then dispatch to the default controller/action pair unless we found something in _GP('SET') which is provided for subsequent 
requests if the Extbase module had a function menu and user chose one function. In this case, we find out the controller/action to use and use it instead.

Let's look a bit closer at what happens for old-school modules:

1) $SOBE->init() sets a few class members, just as Extbase does OK. But it makes a call to method menuConfig() which prepares the entries of the function menu and finally makes a call to method 
handleExternalFunctionValue() which allows externally-added function menu entries to be invoked with base module function menu configuration.

2) $SOBE->main() typically does what basically our Extbase Dispatcher does: see what is the "inner" action to be invoked and dispatch the call to it.

In Dispatcher.php, method getModuleFunctionControllerAction() does a bit what is normally done in scbase's method menuConfig() but misses a call to t3lib_BEfunc::getModuleData() which is used to be 
able to automatically "reactivate" a previously selected function menu (storing the controller/action that was previously invoked would be needed too but we first need to get this information). 
Parameters of method getModuleData() are basically those:

1) the module's function menu configuration
2) content of _GP['SET'] (available from our Dispacther)
3) module name (available from our Dispatcher)

We basically miss the the module's function menu configuration because when we dispatch to the controller/action, we did not ask it (the controller) to give us its function menu, meaning we cannot 
automatically dispatch call to previously selected function menu (which might be externally-added too). From my point of view, this call should be done from within our 
getModuleFunctionControllerAction method, but implies having some kind of menuConfig method available from ActionController.

What do you think?

-- 
Xavier Perseguers
http://xavier.perseguers.ch/en

One contribution a day keeps the fork away


More information about the TYPO3-project-typo3v4mvc mailing list