hide language/theme menu if not more than 1 selection is available

This commit is contained in:
Thomas Rupprecht 2023-03-30 00:05:09 +02:00 committed by Igor Scheller
parent 21d8c27c92
commit 3f0a5a5b73
2 changed files with 18 additions and 10 deletions

View File

@ -92,14 +92,16 @@
</li>
{% endif %}
<li class="nav-item dropdown">
<a class="nav-link dropdown-toggle" href="#" role="button" data-bs-toggle="dropdown" aria-expanded="false">
{{ m.icon('translate') }}
</a>
<ul class="dropdown-menu dropdown-menu-end">
{{ menuLanguages()|join(" ")|raw }}
</ul>
</li>
{% if config('locales')|length > 1 %}
<li class="nav-item dropdown">
<a class="nav-link dropdown-toggle" href="#" role="button" data-bs-toggle="dropdown" aria-expanded="false">
{{ m.icon('translate') }}
</a>
<ul class="dropdown-menu dropdown-menu-end">
{{ menuLanguages()|join(" ")|raw }}
</ul>
</li>
{% endif %}
</ul>
</div>
</div>

View File

@ -243,10 +243,16 @@ class SettingsController extends BaseController
$menu = [
url('/settings/profile') => 'settings.profile',
url('/settings/password') => 'settings.password',
url('/settings/language') => 'settings.language',
url('/settings/theme') => 'settings.theme',
];
if (count(config('locales')) > 1) {
$menu[url('/settings/language')] = 'settings.language';
}
if (count(config('themes')) > 1) {
$menu[url('/settings/theme')] = 'settings.theme';
}
if (!empty(config('oauth'))) {
$menu[url('/settings/oauth')] = ['title' => 'settings.oauth', 'hidden' => $this->checkOauthHidden()];
}