Commit 281c60fb authored by Helmut Hummel's avatar Helmut Hummel Committed by Markus Klein
Browse files

[CLEANUP] Clean up configuration handling in module loader

* Merge label configuration like module configuration
* Correct the merging to be replace instead of merge
* Remove possible notices by checking with empty()

Releases: master
Resolves: #63717
Change-Id: I325e2f35cfe643a54e7f77a76cd8ce2901b950b6
Reviewed-on: http://review.typo3.org/35208


Reviewed-by: Wouter Wolters's avatarWouter Wolters <typo3@wouterwolters.nl>
Tested-by: Wouter Wolters's avatarWouter Wolters <typo3@wouterwolters.nl>
Reviewed-by: default avatarMarkus Klein <klein.t3@reelworx.at>
Tested-by: default avatarMarkus Klein <klein.t3@reelworx.at>
parent 2161e7b7
......@@ -255,11 +255,7 @@ class ModuleLoader {
if (is_object($GLOBALS['LANG'])) {
// $setupInformation['labels']['default']['tabs_images']['tab'] is for modules the reference
// to the module icon.
if (isset($setupInformation['configuration']['labels'])) {
$defaultLabels = $setupInformation['configuration']['labels'];
} else {
$defaultLabels = $setupInformation['labels']['default'];
}
$defaultLabels = $setupInformation['labels']['default'];
// Here the path is transformed to an absolute reference.
if ($defaultLabels['tabs_images']['tab']) {
......@@ -367,7 +363,7 @@ class ModuleLoader {
// The conf-file is included. This must be valid PHP.
include $path . '/conf.php';
// move the global variables defined in conf.php into the local method
// Move the global variables defined in conf.php into the local method
if (is_array($MCONF)) {
$moduleSetupInformation['configuration'] = $MCONF;
} else {
......@@ -376,12 +372,24 @@ class ModuleLoader {
$moduleSetupInformation['labels'] = $MLANG;
}
// overlay them with additional setup information and configuration
if (is_array($GLOBALS['TBE_MODULES']['_configuration'][$moduleName])) {
$moduleSetupInformation['configuration'] = array_merge_recursive($moduleSetupInformation['configuration'], $GLOBALS['TBE_MODULES']['_configuration'][$moduleName]);
$moduleConfiguration = !empty($GLOBALS['TBE_MODULES']['_configuration'][$moduleName]) ? $GLOBALS['TBE_MODULES']['_configuration'][$moduleName] : NULL;
if ($moduleConfiguration !== NULL) {
// Overlay setup with additional labels
if (!empty($moduleConfiguration['labels']) && is_array($moduleConfiguration['labels'])) {
if (empty($moduleSetupInformation['labels']['default']) || !is_array($moduleSetupInformation['labels']['default'])) {
$moduleSetupInformation['labels']['default'] = $moduleConfiguration['labels'];
} else {
$moduleSetupInformation['labels']['default'] = array_replace_recursive($moduleSetupInformation['labels']['default'], $moduleConfiguration['labels']);
}
unset($moduleConfiguration['labels']);
}
// Overlay setup with additional configuration
if (is_array($moduleConfiguration)) {
$moduleSetupInformation['configuration'] = array_replace_recursive($moduleSetupInformation['configuration'], $moduleConfiguration);
}
}
// add some default configuration
// Add some default configuration
if (!isset($moduleSetupInformation['configuration']['inheritNavigationComponentFromMainModule'])) {
$moduleSetupInformation['configuration']['inheritNavigationComponentFromMainModule'] = TRUE;
}
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment