add content language selection #14

This commit is contained in:
ghost 2023-09-25 01:30:28 +03:00
parent d77ad74d32
commit 0d840a5ab5
4 changed files with 100 additions and 52 deletions

View file

@ -46,9 +46,32 @@ class AppControllerPage
public function renderFormDescription()
{
// Prepare locales
$locales = [];
foreach (Environment::config('locales') as $key => $value)
{
$locales[$key] = (object)
[
'key' => $key,
'value' => $value[0],
'active' => false !== stripos($_SERVER['HTTP_ACCEPT_LANGUAGE'], $key) ? true : false,
];
}
// Init form
$form = (object)
[
'locale' => (object)
[
'error' => [],
'values' => $locales,
'attribute' => (object)
[
'value' => null,
'placeholder' => _('Page content language'),
]
],
'title' => (object)
[
'error' => [],