Project

General

Profile

Task #60633

Updated by Benni Mack almost 10 years ago

Currently rendering of the module menu of the backend left side is quite complex. This is beacause there are several parts introduced in recent TYPO3 versions, that have only substited parts of the existing code. So the "old" code was still in use. To give a better understanding I will first introduce all the parts relevant to the rendering of the module menu. 


 PHP side 
 - The mother of all classes is ModuleLoader.php, originally made by Kasper, which takes TBE_MODULES and compiles a long list of all modules into an array. (ModuleLoader->load()). Currently this class is kept as is for the time being. 
 - For 4.1/4.2, the ModuleMenuView was introduced, a wrapper class to access the data of ModuleLoader and also does some other stuff like saving the Open/Collapsed state of the modules via AJAX (note: this will be handled browser-internally via LocalStorage in the future, as it saves us HTTP requests). It does one other thing: Rendering of the Logout Button. This is completely in the wrong place, as the Logout button isn't within the module menu frame anymore, but on the top right area of the backend.  
 - The BackendController class is responsible for adding all HTML and JS code code to the backend.php page so it can be rendered. It instantiates the ModuleMenuView class to call the LogoutButton function. 
 - As one of the first steps of rewriting the module menu a couple of versions ago, there was a ModuleController, which was again a wrapper for ModuleLoader while putting everything together in a ModuleRepository, along with Module objects and a singleton object ModuleStorage. This new version allows for nesting of up to three levels (incl. modfuncs), along with clear objects instead of arrays. 


 JS side 
 - The module menu isn't output with a single line of PHP code, as it is defined as a ExtJS storage which fetches the module menu asynchronous. The HTML code is built in a ExtJS template, which leads to the funny effect that the raw backend.php only zero HTML code output for the module menu. 
 An extra AJAX request is fired to load up the module, which then is prepared and templated by ExtJS. 


 The changes: 
 - The logout button rendering is now done in the BackendController and not in the ModuleMenuView class. 
 - The menu is now outputted in the BackendController at the same time as backend.php by a standalone Fluid template. The menu is built by a simple call to the ModuleRepository which returns a ModuleStorage. 
 - ModuleMenuView, ModuleMenuController are not needed anymore, and are deprecated. 
 - The JS is rewritten so that it works again. These parts are filled up with jQuery code. 
 - The collapsed/open state of the main modules is now done via the local storage JS functionality of the browsers to avoid further unnecessary HTTP loading operations. 

 


 Still todo: 
 - implement one AJAX call to fetch the module menu data via AJAX to re-implement "reloadMenu". Any reloads of the menu should be done via jQuery AJAX. 
 - re-implement collapsed/open state via the local storage JS functionality of the browsers to avoid further unnecessary loading operations.

Back