Skip to content

Commit

Permalink
Merge pull request #6 from roadster31/modules-fix
Browse files Browse the repository at this point in the history
Using proper directory name case to check module domains
  • Loading branch information
roadster31 authored Oct 23, 2019
2 parents 52a9ddd + ddcf0b4 commit ebfa503
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 10 deletions.
2 changes: 1 addition & 1 deletion Config/module.xml
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
<language>en_US</language>
<language>fr_FR</language>
</languages>
<version>1.0.3</version>
<version>1.0.4</version>
<authors>
<author>
<name>Vincent Lopes-Vicente, Nicolas Barbey</name>
Expand Down
27 changes: 18 additions & 9 deletions Controller/ExportController.php
Original file line number Diff line number Diff line change
Expand Up @@ -250,8 +250,16 @@ protected function getModulesDirectories()
{
$modulesNames = scandir(THELIA_LOCAL_DIR.'modules'.DS);
$directories = [];
$types = [ 'Core', 'FrontOffice', 'BackOffice', 'Email', 'Pdf'];
$types = [
'core' => 'Core',
'frontOffice' => 'FrontOffice',
'backOffice' => 'BackOffice',
'email' => 'Email',
'pdf' => 'Pdf'
];

$domain = null;

foreach ($modulesNames as $moduleName){
if ($moduleName[0] !== '.'){
/** @var Module $module */
Expand All @@ -261,18 +269,18 @@ protected function getModulesDirectories()
continue;
}

foreach ($types as $type){
$getDomainFunction = 'get'.$type.'TemplateTranslationDomain';
$getPathFunction = 'getAbsolute'.$type.'TemplatePath';
$templateNames = [];
if (file_exists($module->getAbsoluteBaseDir().DS.'templates'.DS.$type)){
$templateNames = $this->getTemplateNames($module->getAbsoluteBaseDir().DS.'templates'.DS.$type);
}

foreach ($types as $dirName => $type){
if ($type === 'Core') {
$getDomainFunction = 'getTranslationDomain';
$getPathFunction = 'getAbsoluteBaseDir';
$templateNames[] = $type;
} else {
$getDomainFunction = 'get'.$type.'TemplateTranslationDomain';
$getPathFunction = 'getAbsolute'.$type.'TemplatePath';
$templateNames = [];
if (file_exists($module->getAbsoluteBaseDir().DS.'templates'.DS.$dirName)){
$templateNames = $this->getTemplateNames($module->getAbsoluteBaseDir().DS.'templates'.DS.$dirName);
}
}

foreach ($templateNames as $templateName){
Expand All @@ -286,6 +294,7 @@ protected function getModulesDirectories()
}
}
}

return $directories;
}

Expand Down

0 comments on commit ebfa503

Please sign in to comment.