Added a quick and dirty way to guess in an inactive module has a config

route
This commit is contained in:
Franck Allimant
2014-01-21 23:56:47 +01:00
parent 3b3e993514
commit c9c489a76b

View File

@@ -194,7 +194,10 @@ class Module extends BaseI18nLoop implements PropelSearchLoopInterface
$hasConfigurationInterface = false; $hasConfigurationInterface = false;
/* first test if module defines it's own config route */ /* first test if module defines it's own config route */
if ($module->getActivate()) {
// Works only fo activated modules - see Thelia\Core\DependencyInjection\Compiler\RegisterRouterPass
$routerId = "router." . $module->getBaseDir(); $routerId = "router." . $module->getBaseDir();
if ($this->container->has($routerId)) { if ($this->container->has($routerId)) {
try { try {
@@ -212,6 +215,15 @@ class Module extends BaseI18nLoop implements PropelSearchLoopInterface
$hasConfigurationInterface = true; $hasConfigurationInterface = true;
} }
} }
}
else {
// Make a quick and dirty test on the module's routing.xml file
$routing = @file_get_contents($module->getAbsoluteBaseDir() . DS . "Config" . DS . "routing.xml");
if ($routing && strpos($routing, '/admin/module/') !== false) {
$hasConfigurationInterface = true;
}
}
$loopResultRow->set("CONFIGURABLE", $hasConfigurationInterface ? 1 : 0); $loopResultRow->set("CONFIGURABLE", $hasConfigurationInterface ? 1 : 0);