FIX: fix template path registrator

This commit is contained in:
Michal Kváček
2016-09-28 00:14:18 +02:00
parent 3a0a132701
commit 5b9b5c0d38
4 changed files with 10 additions and 4 deletions
@@ -112,13 +112,16 @@ class TemplateRegistrator
} }
foreach ($this->paths as $path) { foreach ($this->paths as $path) {
if (!empty($path['namespace'])) {
$this->setNamespace($path['namespace'] . '::'); $this->setNamespace($path['namespace'] . '::');
}
$this->setModuleId($path['moduleId']); $this->setModuleId($path['moduleId']);
$this->setBaseDirectory($path['baseDirectory']); $this->setBaseDirectory($path['baseDirectory']);
$this->registeredPath = $this->baseDirectory . DIRECTORY_SEPARATOR . $path['path']; $this->registeredPath = $this->baseDirectory . DIRECTORY_SEPARATOR . $path['path'];
// register path // register path
$this->registerPath($this->registeredPath, $path['name']); $this->registerPath($this->registeredPath, $path['name']);
$this->unsetNamespace();
} }
} }
@@ -33,6 +33,9 @@ class AdminMenuRegistrator
// iterate over all enabled modules // iterate over all enabled modules
foreach ($modules as $key => $module) { foreach ($modules as $key => $module) {
if (!is_callable([$module->handler, 'registerAdminMenu']))
continue;
// try to register menus // try to register menus
try { try {
call_user_func([$module->handler, 'registerAdminMenu'], $user); call_user_func([$module->handler, 'registerAdminMenu'], $user);
@@ -38,7 +38,7 @@ class SetHomepage extends Controller
public function getPages() public function getPages()
{ {
// get pages which are assigned as homepage parts // get pages which are assigned as homepage parts
$usedPagesIds = (array)json_decode(Settings::get(OnePage::HOMEPAGE_PAGES_SETTINGS_KEY, '{}')); $usedPagesIds = (array)Settings::getJson(OnePage::HOMEPAGE_PAGES_SETTINGS_KEY);
// get all pages - they will be separated for used and not used on next lines // get all pages - they will be separated for used and not used on next lines
$allPages = $this->content->getOverview() $allPages = $this->content->getOverview()
@@ -128,7 +128,7 @@ class SetHomepage extends Controller
*/ */
public function removePage($id) public function removePage($id)
{ {
$pages = (array)json_decode(Settings::get(OnePage::HOMEPAGE_PAGES_SETTINGS_KEY, '{}')); $pages = (array)Settings::getJson(OnePage::HOMEPAGE_PAGES_SETTINGS_KEY);
$page = Content::findOrFail($id); $page = Content::findOrFail($id);
@@ -66,7 +66,7 @@ class Handler extends OnePage
return [ return [
[ [
'module' => 'StaticPages', 'module' => 'StaticPages',
'templateName' => 'staticpages::admin/adminMenu.templatePath' 'templateName' => 'staticpages::admin.templatePath'
], ],
[ [
'module' => 'ContactForm', 'module' => 'ContactForm',