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

View File

@ -243,10 +243,16 @@ class SettingsController extends BaseController
$menu = [ $menu = [
url('/settings/profile') => 'settings.profile', url('/settings/profile') => 'settings.profile',
url('/settings/password') => 'settings.password', 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'))) { if (!empty(config('oauth'))) {
$menu[url('/settings/oauth')] = ['title' => 'settings.oauth', 'hidden' => $this->checkOauthHidden()]; $menu[url('/settings/oauth')] = ['title' => 'settings.oauth', 'hidden' => $this->checkOauthHidden()];
} }