From 8ac7a4e01cf0e0c89968d077f2fa78d7362c56a7 Mon Sep 17 00:00:00 2001 From: ikkebra Date: Mon, 30 Dec 2019 07:25:11 -0700 Subject: [PATCH] Show a disabled setting->description on edit The setting->description describes what the setting does, but we are never able to see the full description in the admin panel. We are able to see a truncated description in the index view of the settings i.e. "Email addresses separated by comma, to b[...]" but when we edit that setting, we don't see the description at all. The description provides useful information on what the setting does and should be shown on the edit page as a disabled field, similar to the setting->name. I made it a textarea instead of text in case the description is overly long. --- src/app/Http/Controllers/SettingCrudController.php | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/src/app/Http/Controllers/SettingCrudController.php b/src/app/Http/Controllers/SettingCrudController.php index 340087f..dfee39a 100644 --- a/src/app/Http/Controllers/SettingCrudController.php +++ b/src/app/Http/Controllers/SettingCrudController.php @@ -49,6 +49,15 @@ public function setupUpdateOperation() 'disabled' => 'disabled', ], ]); + + CRUD::addField([ + 'name' => 'description', + 'label' => trans('backpack::settings.description'), + 'type' => 'textarea', + 'attributes' => [ + 'disabled' => 'disabled', + ], + ]); CRUD::addField(json_decode(CRUD::getCurrentEntry()->field, true)); }