diff --git a/config/packages/twig.yaml b/config/packages/twig.yaml
index bb4bf838..d04a93e6 100644
--- a/config/packages/twig.yaml
+++ b/config/packages/twig.yaml
@@ -7,7 +7,6 @@ twig:
globals:
default_currency: '%partdb.default_currency%'
- global_theme: '%partdb.global_theme%'
allow_email_pw_reset: '%partdb.users.email_pw_reset%'
locale_menu: '%partdb.locale_menu%'
attachment_manager: '@App\Services\Attachments\AttachmentManager'
diff --git a/config/parameters.yaml b/config/parameters.yaml
index e7126438..58f8c223 100644
--- a/config/parameters.yaml
+++ b/config/parameters.yaml
@@ -11,7 +11,6 @@ parameters:
# This is used as workaround for places where we can not access the settings directly (like the 2FA application names)
partdb.title: '%env(string:settings:customization:instanceName)%' # The title shown inside of Part-DB (e.g. in the navbar and on homepage)
partdb.default_currency: '%env(string:BASE_CURRENCY)%' # The currency that is used inside the DB (and is assumed when no currency is set). This can not be changed later, so be sure to set it the currency used in your country
- partdb.global_theme: '' # The theme to use globally (see public/build/themes/ for choices, use name without .css). Set to '' for default bootstrap theme
partdb.locale_menu: ['en', 'de', 'it', 'fr', 'ru', 'ja', 'cs', 'da', 'zh'] # The languages that are shown in user drop down menu
partdb.enforce_change_comments_for: '%env(csv:ENFORCE_CHANGE_COMMENTS_FOR)%' # The actions for which a change comment is required (e.g. "part_edit", "part_create", etc.). If this is empty, change comments are not required at all.
diff --git a/src/Settings/SystemSettings/CustomizationSettings.php b/src/Settings/SystemSettings/CustomizationSettings.php
index 39dd4663..bcb0e98f 100644
--- a/src/Settings/SystemSettings/CustomizationSettings.php
+++ b/src/Settings/SystemSettings/CustomizationSettings.php
@@ -24,6 +24,8 @@ declare(strict_types=1);
namespace App\Settings\SystemSettings;
use App\Form\Type\RichTextEditorType;
+use App\Form\Type\ThemeChoiceType;
+use App\Validator\Constraints\ValidTheme;
use Jbtronics\SettingsBundle\Metadata\EnvVarMode;
use Jbtronics\SettingsBundle\Settings\Settings;
use Jbtronics\SettingsBundle\Settings\SettingsParameter;
@@ -48,4 +50,10 @@ class CustomizationSettings
)]
public ?string $banner = null;
+ #[SettingsParameter(
+ label: new TM("settings.system.customization.theme"),
+ formType: ThemeChoiceType::class, formOptions: ['placeholder' => false]
+ )]
+ #[ValidTheme]
+ public string $theme = 'bootstrap';
}
\ No newline at end of file
diff --git a/templates/base.html.twig b/templates/base.html.twig
index 263dcbba..634a9983 100644
--- a/templates/base.html.twig
+++ b/templates/base.html.twig
@@ -40,14 +40,12 @@
- {% if not app.user.theme is defined %}
- {% set theme = global_theme %}
+ {% if app.user.theme is not defined or app.user.theme is null %}
+ {% set theme = settings_instance('customization').theme %}
{% else %}
{% set theme = app.user.theme %}
{% endif %}
-
-
{% if theme and theme in available_themes and encore_entry_exists('theme_' ~ theme) %}
{{ encore_entry_link_tags('theme_' ~ theme) }}
{% else %}
diff --git a/translations/messages.en.xlf b/translations/messages.en.xlf
index 6cf18b12..95f3ad07 100644
--- a/translations/messages.en.xlf
+++ b/translations/messages.en.xlf
@@ -12467,5 +12467,11 @@ Please note, that you can not impersonate a disabled user. If you try you will g
Save removed data in log entries on element deletion
+
+
+ settings.system.customization.theme
+ Global theme
+
+