diff --git a/boot.php b/boot.php index ffc87f27..a0a237a4 100644 --- a/boot.php +++ b/boot.php @@ -30,7 +30,9 @@ } rex_ycom::addTable(rex::getTablePrefix() . 'ycom_user'); -rex_yform_manager_dataset::setModelClass(rex::getTablePrefix() . 'ycom_user', rex_ycom_user::class); +if(rex_config::get('ycom', 'auto_model_class') === true) { + rex_yform_manager_dataset::setModelClass(rex::getTablePrefix() . 'ycom_user', rex_ycom_user::class); +} if (rex::isBackend() && ('index.php?page=content/edit' == rex_url::currentBackendPage() || 'mediapool' == rex_be_controller::getCurrentPagePart(1))) { rex_view::addJsFile($this->getAssetsUrl('ycom_backend.js')); diff --git a/package.yml b/package.yml index 4aed46cb..e58766ad 100644 --- a/package.yml +++ b/package.yml @@ -26,3 +26,6 @@ requires: system_plugins: - auth - group + +default_config: + auto_model_class: true diff --git a/plugins/auth/pages/settings.php b/plugins/auth/pages/settings.php index c846e6a6..cd89c052 100644 --- a/plugins/auth/pages/settings.php +++ b/plugins/auth/pages/settings.php @@ -31,6 +31,7 @@ $this->setConfig('login_field', stripslashes(str_replace('"', '', rex_request('login_field', 'string')))); $this->setConfig('session_max_overall_duration', rex_request('session_max_overall_duration', 'int')); $this->setConfig('session_duration', rex_request('session_duration', 'int')); + $this->setConfig('auto_model_class', rex_request('session_duration', 'bool')); echo rex_view::success($this->i18n('ycom_auth_settings_updated')); } @@ -71,6 +72,14 @@ $sel_authcookiettl->addOption($this->i18n('ycom_days', 30), '30'); $sel_authcookiettl->addOption($this->i18n('ycom_days', 90), '90'); +$sel_auto_model_class = new rex_select(); +$sel_auto_model_class->setId('auto_model_class'); +$sel_auto_model_class->setName('auto_model_class'); +$sel_auto_model_class->setSize(1); +$sel_auto_model_class->addOption('Ja', '1'); +$sel_auto_model_class->addOption('Nein', '0'); +$sel_auto_model_class->setSelected($this->getConfig('auto_model_class')); + $content .= '
@@ -200,6 +209,7 @@ +
' . $this->i18n('ycom_auth_config_security') . ' @@ -258,6 +268,20 @@
+ +
+ ' . $this->i18n('ycom_auto_model_class') . ' +
+
+ ' . $this->i18n('ycom_auto_model_class') . ' +
+
+
+ ' . $sel_auto_model_class->get() . ' +
+
+
+
diff --git a/plugins/group/boot.php b/plugins/group/boot.php index 76cbf76f..c044cc5a 100644 --- a/plugins/group/boot.php +++ b/plugins/group/boot.php @@ -5,7 +5,9 @@ * @psalm-scope-this rex_addon */ -rex_yform_manager_dataset::setModelClass(rex::getTablePrefix() . 'ycom_group', rex_ycom_group::class); + if(rex_config::get('ycom', 'auto_model_class') === true) { + rex_yform_manager_dataset::setModelClass(rex::getTablePrefix() . 'ycom_group', rex_ycom_group::class); +} rex_ycom::addTable(rex::getTablePrefix() . 'ycom_group'); if (rex::isBackend()) {