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