From e183c7c8be7d32b146b243ab349283b9e97ded4c Mon Sep 17 00:00:00 2001 From: Franck Allimant Date: Tue, 22 Apr 2014 15:53:35 +0200 Subject: [PATCH] Check if a module has admin incude files. --- .../Admin/TranslationsController.php | 18 ++++++++++++++++++ templates/backOffice/default/translations.html | 5 ++++- 2 files changed, 22 insertions(+), 1 deletion(-) diff --git a/core/lib/Thelia/Controller/Admin/TranslationsController.php b/core/lib/Thelia/Controller/Admin/TranslationsController.php index 880e0a1b2..84c0f7579 100644 --- a/core/lib/Thelia/Controller/Admin/TranslationsController.php +++ b/core/lib/Thelia/Controller/Admin/TranslationsController.php @@ -12,6 +12,7 @@ namespace Thelia\Controller\Admin; +use Symfony\Component\Finder\Finder; use Thelia\Core\Security\Resource\AdminResources; use Thelia\Core\Security\AccessManager; use Thelia\Model\Module; @@ -128,6 +129,23 @@ class TranslationsController extends BaseAdminController $templateArguments['front_office_templates'] = implode(',', $this->getModuleTemplateNames($module, TemplateDefinition::FRONT_OFFICE)); + // Check if we have admin-include files + try { + $finder = Finder::create() + ->files() + ->depth(0) + ->in($module->getAbsoluteAdminIncludesPath()) + ->name('/\.html$/i') + ; + + $hasAdminIncludes = $finder->count() > 0; + } + catch (\InvalidArgumentException $ex) { + $hasAdminIncludes = false; + } + + $templateArguments['has_admin_includes'] = $hasAdminIncludes; + break; // Thelia Core diff --git a/templates/backOffice/default/translations.html b/templates/backOffice/default/translations.html index 10e6cc92d..4582a8ae2 100644 --- a/templates/backOffice/default/translations.html +++ b/templates/backOffice/default/translations.html @@ -128,7 +128,10 @@