-
-
Notifications
You must be signed in to change notification settings - Fork 3
Bundle
IDMarinas edited this page Jul 29, 2021
·
4 revisions
Here are some tips to migrate your old modules to the new Bundle system.
At the moment not all modules can be migrated to a Bundle.
- Modules that use
module_addeventhook
i.e. the special events system of the game.- For example, special events in the forest, the village...
- Modules that make use of the
prefs
orprefs-*
(likeprefs-drinks
,prefs-mounts
...) configuration for now there is no option to transfer this data.
- Modules that do not fall under the previous section, there should be no problem to migrate them to a Bundle.
- If the module uses
settings
for its configuration. You should use the configuration of a Symfony Bundle. - For user prefs
prefs
I'm preparing a Bundle Settings that allow set a settings for bundle and/or user- These settings are intended to save certain settings for the user or the bundle itself that will change during runtime.
- In case you do not need the settings to change at runtime it is better to use the Symfony Bundle configuration system.
- Modules that use
MODULE_run
for show content withrunmodule.php?module=*
.- Use:
- Create controllers for your new Bundle
- If your module use:
function MODULE_getmoduleinfo() { return [ //.... 'allowanonymous' => true, 'override_forced_nav' => true, //.... ]; }
- Replace this with:
- Implement in controller interface
Lotgd\Core\Controller\LotgdControllerInterface
- Configure as you need. Remember that this configuration is for all methods in controller.
- If you need some method public and other for user logged, create diferent controller.
- Configure as you need. Remember that this configuration is for all methods in controller.
- Implement in controller interface
- Replace this with:
- Replace
runmodule.php?module=MODULE_NAME
forrunmodule.php?method=METHOD_NAME&controller=urlencode(CONTROLLER_NAME)
//-- Example $url = 'runmodule.php?method=index&controller='.urlencode(\Lotgd\Local\Controller\ModuleController::class); \LotgdNavigation::addNav('Do anything', $url);
- Use:
Example of modules migrated to a Bundle system.