Check if a module has admin incude files.
This commit is contained in:
@@ -12,6 +12,7 @@
|
|||||||
|
|
||||||
namespace Thelia\Controller\Admin;
|
namespace Thelia\Controller\Admin;
|
||||||
|
|
||||||
|
use Symfony\Component\Finder\Finder;
|
||||||
use Thelia\Core\Security\Resource\AdminResources;
|
use Thelia\Core\Security\Resource\AdminResources;
|
||||||
use Thelia\Core\Security\AccessManager;
|
use Thelia\Core\Security\AccessManager;
|
||||||
use Thelia\Model\Module;
|
use Thelia\Model\Module;
|
||||||
@@ -128,6 +129,23 @@ class TranslationsController extends BaseAdminController
|
|||||||
$templateArguments['front_office_templates'] =
|
$templateArguments['front_office_templates'] =
|
||||||
implode(',', $this->getModuleTemplateNames($module, TemplateDefinition::FRONT_OFFICE));
|
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;
|
break;
|
||||||
|
|
||||||
// Thelia Core
|
// Thelia Core
|
||||||
|
|||||||
@@ -128,7 +128,10 @@
|
|||||||
<select id="module_part" required="required" name="module_part" class="submit-on-change form-control">
|
<select id="module_part" required="required" name="module_part" class="submit-on-change form-control">
|
||||||
<option value="">{intl l='Please select the module component'}</option>
|
<option value="">{intl l='Please select the module component'}</option>
|
||||||
<option value="core" {if $module_part == 'core'}selected="selected"{/if}>Core files</option>
|
<option value="core" {if $module_part == 'core'}selected="selected"{/if}>Core files</option>
|
||||||
|
|
||||||
|
{if $has_admin_includes}
|
||||||
<option value="admin-includes" {if $module_part == 'admin-includes'}selected="selected"{/if}>Administration includes template</option>
|
<option value="admin-includes" {if $module_part == 'admin-includes'}selected="selected"{/if}>Administration includes template</option>
|
||||||
|
{/if}
|
||||||
|
|
||||||
{if $back_office_templates != ''}
|
{if $back_office_templates != ''}
|
||||||
{foreach explode(',', $back_office_templates) as $template}
|
{foreach explode(',', $back_office_templates) as $template}
|
||||||
|
|||||||
Reference in New Issue
Block a user