Make BaseModule methods dynamic

This commit is contained in:
Philipp 2021-11-14 23:13:47 +01:00
parent 714f0febc4
commit 489cd0884a
No known key found for this signature in database
GPG key ID: 24A7501396EB5432
253 changed files with 397 additions and 385 deletions

View file

@ -297,32 +297,32 @@ class Module
Core\Hook::callAll($this->module . '_mod_init', $placeholder);
$this->module_class::init();
$this->module_class->init();
$profiler->set(microtime(true) - $timestamp, 'init');
if ($server['REQUEST_METHOD'] === Router::DELETE) {
$this->module_class::delete();
$this->module_class->delete();
}
if ($server['REQUEST_METHOD'] === Router::PATCH) {
$this->module_class::patch();
$this->module_class->patch();
}
if ($server['REQUEST_METHOD'] === Router::POST) {
Core\Hook::callAll($this->module . '_mod_post', $post);
$this->module_class::post();
$this->module_class->post();
}
if ($server['REQUEST_METHOD'] === Router::PUT) {
$this->module_class::put();
$this->module_class->put();
}
Core\Hook::callAll($this->module . '_mod_afterpost', $placeholder);
$this->module_class::afterpost();
$this->module_class->afterpost();
// "rawContent" is especially meant for technical endpoints.
// This endpoint doesn't need any theme initialization or other comparable stuff.
$this->module_class::rawContent();
$this->module_class->rawContent();
}
}

View file

@ -350,13 +350,13 @@ class Page implements ArrayAccess
$moduleClass = $module->getClass();
$arr = ['content' => $content];
Hook::callAll( $moduleClass::getClassName() . '_mod_content', $arr);
Hook::callAll( $moduleClass->getClassName() . '_mod_content', $arr);
$content = $arr['content'];
$arr = ['content' => $moduleClass::content()];
Hook::callAll($moduleClass::getClassName() . '_mod_aftercontent', $arr);
$arr = ['content' => $moduleClass->content()];
Hook::callAll($moduleClass->getClassName() . '_mod_aftercontent', $arr);
$content .= $arr['content'];
} catch (HTTPException $e) {
$content = ModuleHTTPException::content($e);
$content = (new ModuleHTTPException())->content($e);
}
// initialise content region