mirror of
https://github.com/pelican-dev/panel.git
synced 2025-05-20 19:14:45 +02:00
add back width select to admin settings
This commit is contained in:
parent
5a36f9825b
commit
f37915ed2a
@ -8,6 +8,7 @@ use App\Extensions\OAuth\Providers\OAuthProvider;
|
|||||||
use App\Models\Backup;
|
use App\Models\Backup;
|
||||||
use App\Notifications\MailTested;
|
use App\Notifications\MailTested;
|
||||||
use App\Traits\EnvironmentWriterTrait;
|
use App\Traits\EnvironmentWriterTrait;
|
||||||
|
use BackedEnum;
|
||||||
use Exception;
|
use Exception;
|
||||||
use Filament\Actions\Action;
|
use Filament\Actions\Action;
|
||||||
use Filament\Forms\Components\Hidden;
|
use Filament\Forms\Components\Hidden;
|
||||||
@ -234,12 +235,12 @@ class Settings extends Page implements HasSchemas
|
|||||||
$set('TRUSTED_PROXIES', $ips->values()->all());
|
$set('TRUSTED_PROXIES', $ips->values()->all());
|
||||||
}),
|
}),
|
||||||
]),
|
]),
|
||||||
// Select::make('FILAMENT_WIDTH')
|
Select::make('FILAMENT_WIDTH')
|
||||||
// ->label(trans('admin/setting.general.display_width'))
|
->label(trans('admin/setting.general.display_width'))
|
||||||
// ->native(false)
|
->native(false)
|
||||||
// ->options(Width::class->value)
|
->options(Width::class)
|
||||||
// ->selectablePlaceholder(false)
|
->selectablePlaceholder(false)
|
||||||
// ->default(env('FILAMENT_WIDTH', config('panel.filament.display-width'))),
|
->default(env('FILAMENT_WIDTH', config('panel.filament.display-width'))),
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -762,8 +763,19 @@ class Settings extends Page implements HasSchemas
|
|||||||
try {
|
try {
|
||||||
$data = $this->form->getState();
|
$data = $this->form->getState();
|
||||||
|
|
||||||
|
$data = array_map(function ($value) {
|
||||||
// Convert bools to a string, so they are correctly written to the .env file
|
// Convert bools to a string, so they are correctly written to the .env file
|
||||||
$data = array_map(fn ($value) => is_bool($value) ? ($value ? 'true' : 'false') : $value, $data);
|
if (is_bool($value)) {
|
||||||
|
return $value ? 'true' : 'false';
|
||||||
|
}
|
||||||
|
|
||||||
|
// Convert enum to its value
|
||||||
|
if ($value instanceof BackedEnum) {
|
||||||
|
return $value->value;
|
||||||
|
}
|
||||||
|
|
||||||
|
return $value;
|
||||||
|
}, $data);
|
||||||
|
|
||||||
$this->writeToEnvironment($data);
|
$this->writeToEnvironment($data);
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user