Insert theme init after module init but before post/content
This commit is contained in:
parent
892a395eb7
commit
af7b852d04
1 changed files with 14 additions and 12 deletions
24
src/App.php
24
src/App.php
|
@ -1720,13 +1720,7 @@ class App
|
||||||
|
|
||||||
$content = '';
|
$content = '';
|
||||||
|
|
||||||
// Load current theme info after module has been executed as theme could have been set in module
|
// Initialize module that can set the current theme in the init() method, either directly or via App->profile_uid
|
||||||
$theme_info_file = 'view/theme/' . $this->getCurrentTheme() . '/theme.php';
|
|
||||||
if (file_exists($theme_info_file)) {
|
|
||||||
require_once $theme_info_file;
|
|
||||||
}
|
|
||||||
|
|
||||||
// Call module functions
|
|
||||||
if ($this->module_loaded) {
|
if ($this->module_loaded) {
|
||||||
$this->page['page_title'] = $this->module;
|
$this->page['page_title'] = $this->module;
|
||||||
$placeholder = '';
|
$placeholder = '';
|
||||||
|
@ -1734,11 +1728,12 @@ class App
|
||||||
Core\Addon::callHooks($this->module . '_mod_init', $placeholder);
|
Core\Addon::callHooks($this->module . '_mod_init', $placeholder);
|
||||||
|
|
||||||
call_user_func([$this->module_class, 'init']);
|
call_user_func([$this->module_class, 'init']);
|
||||||
|
}
|
||||||
|
|
||||||
// "rawContent" is especially meant for technical endpoints.
|
// Load current theme info after module has been initialized as theme could have been set in module
|
||||||
// This endpoint doesn't need any theme initialization or other comparable stuff.
|
$theme_info_file = 'view/theme/' . $this->getCurrentTheme() . '/theme.php';
|
||||||
if (!$this->error) {
|
if (file_exists($theme_info_file)) {
|
||||||
call_user_func([$this->module_class, 'rawContent']);
|
require_once $theme_info_file;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (function_exists(str_replace('-', '_', $this->getCurrentTheme()) . '_init')) {
|
if (function_exists(str_replace('-', '_', $this->getCurrentTheme()) . '_init')) {
|
||||||
|
@ -1746,6 +1741,13 @@ class App
|
||||||
$func($this);
|
$func($this);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if ($this->module_loaded) {
|
||||||
|
// "rawContent" is especially meant for technical endpoints.
|
||||||
|
// This endpoint doesn't need any theme initialization or other comparable stuff.
|
||||||
|
if (!$this->error) {
|
||||||
|
call_user_func([$this->module_class, 'rawContent']);
|
||||||
|
}
|
||||||
|
|
||||||
if (! $this->error && $_SERVER['REQUEST_METHOD'] === 'POST') {
|
if (! $this->error && $_SERVER['REQUEST_METHOD'] === 'POST') {
|
||||||
Core\Addon::callHooks($this->module . '_mod_post', $_POST);
|
Core\Addon::callHooks($this->module . '_mod_post', $_POST);
|
||||||
call_user_func([$this->module_class, 'post']);
|
call_user_func([$this->module_class, 'post']);
|
||||||
|
|
Loading…
Reference in a new issue