configure button in module page
This commit is contained in:
@@ -148,6 +148,23 @@ class Module extends BaseI18nLoop implements PropelSearchLoopInterface
|
||||
->set("CLASS", $module->getFullNamespace())
|
||||
->set("POSITION", $module->getPosition());
|
||||
|
||||
$hasConfigurationInterface = false;
|
||||
$routerId = "router." . $module->getBaseDir();
|
||||
/* first test if module defines it's own config route */
|
||||
if($this->container->has($routerId)) {
|
||||
if($this->container->get($routerId)->match('/admin/module/' . $module->getCode())) {
|
||||
$hasConfigurationInterface = true;
|
||||
}
|
||||
}
|
||||
/* 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"))) {
|
||||
$hasConfigurationInterface = true;
|
||||
}
|
||||
}
|
||||
|
||||
$loopResultRow->set("CONFIGURABLE", $hasConfigurationInterface ? 1 : 0);
|
||||
|
||||
if (null !== $this->getProfile()) {
|
||||
$accessValue = $module->getVirtualColumn('access');
|
||||
$manager = new AccessManager($accessValue);
|
||||
|
||||
@@ -41,10 +41,11 @@
|
||||
|
||||
|
||||
|
||||
|
||||
{loop type="auth" name="can_change" role="ADMIN" module=$CODE access="VIEW"}
|
||||
<a class="btn btn-primary btn-xs" title="{intl l='Configure this module'}" href="{url path="/admin/module/$CODE"}">{intl l="Configure"}</a>
|
||||
{/loop}
|
||||
{if $CONFIGURABLE == 1}
|
||||
{loop type="auth" name="can_change" role="ADMIN" module=$CODE access="VIEW"}
|
||||
<a class="btn btn-primary btn-xs" title="{intl l='Configure this module'}" href="{url path="/admin/module/$CODE"}">{intl l="Configure"}</a>
|
||||
{/loop}
|
||||
{/if}
|
||||
|
||||
{*loop type="auth" name="can_change" role="ADMIN" resource="admin.modules" access="VIEW"}
|
||||
<a class="btn btn-default btn-xs" title="{intl l='Read the documentation of this module'}" href="{url path="/admin/module/documentation/$ID"}"><span class="glyphicon glyphicon-book"></span></a>
|
||||
|
||||
Reference in New Issue
Block a user