From a4935a556c65a81d0c116b98d95620bf14914901 Mon Sep 17 00:00:00 2001 From: Etienne Roudeix Date: Fri, 15 Nov 2013 16:35:29 +0100 Subject: [PATCH] fix modules bug --- core/lib/Thelia/Core/Template/Loop/Module.php | 13 ++++++++++--- .../templates/backoffice/default/tdb-index.html} | 0 2 files changed, 10 insertions(+), 3 deletions(-) rename local/modules/{Colissimo/templates/backoffice/default/admin.html => TheliaDebugBar/templates/backoffice/default/tdb-index.html} (100%) diff --git a/core/lib/Thelia/Core/Template/Loop/Module.php b/core/lib/Thelia/Core/Template/Loop/Module.php index 68d9243dd..9815faf7e 100755 --- a/core/lib/Thelia/Core/Template/Loop/Module.php +++ b/core/lib/Thelia/Core/Template/Loop/Module.php @@ -24,6 +24,7 @@ namespace Thelia\Core\Template\Loop; use Propel\Runtime\ActiveQuery\Criteria; +use Symfony\Component\Routing\Exception\ResourceNotFoundException; use Thelia\Core\Security\AccessManager; use Thelia\Core\Template\Element\BaseI18nLoop; use Thelia\Core\Template\Element\LoopResult; @@ -149,13 +150,19 @@ class Module extends BaseI18nLoop implements PropelSearchLoopInterface ->set("POSITION", $module->getPosition()); $hasConfigurationInterface = false; - $routerId = "router." . $module->getBaseDir(); + /* first test if module defines it's own config route */ + $routerId = "router." . $module->getBaseDir(); if($this->container->has($routerId)) { - if($this->container->get($routerId)->match('/admin/module/' . $module->getCode())) { - $hasConfigurationInterface = true; + try { + if($this->container->get($routerId)->match('/admin/module/' . $module->getCode())) { + $hasConfigurationInterface = true; + } + } catch(ResourceNotFoundException $e) { + /* $hasConfigurationInterface stays false */ } } + /* if not ; test if it uses admin inclusion : module_configuration.html */ if(false === $hasConfigurationInterface) { if(file_exists( sprintf("%s/%s/AdminIncludes/%s.html", THELIA_MODULE_DIR, $module->getBaseDir(), "module_configuration"))) { diff --git a/local/modules/Colissimo/templates/backoffice/default/admin.html b/local/modules/TheliaDebugBar/templates/backoffice/default/tdb-index.html similarity index 100% rename from local/modules/Colissimo/templates/backoffice/default/admin.html rename to local/modules/TheliaDebugBar/templates/backoffice/default/tdb-index.html