How to modify field in Laravel-Backpack/Settings

1.7k views Asked by At

enter image description here

Instead of a text field, I'd like to add a dropdown to Value field in Laravel-Backpack/Settings, admin/setting/10/edit page. I appreciate any suggestions.

I used the following in DB settings field but it gives an error.

{"name":"value","label":"Value", "title":"Lightbox" ,"type":"select_from_array",
"options":{"lightbox":"lightbox","colorbox1":"colorbox1"}

Error

ErrorException in Fields.php line 28: Undefined index: name in Fields.php line 28 at HandleExceptions->handleError('8', 'Undefined index: name', '/Users/sokada/Code/backpack-ceci/vendor/backpack/crud/src/PanelTraits/Fields.php', '28', array('field' => array(), 'form' => 'both', 'complete_field_array' => array())) in Fields.php line 28 at CrudPanel->addField(array()) in SettingCrudController.php line 69

Line #28 in Fields.php is followings.

...
    // if the label is missing, we should set it
    if (! isset($complete_field_array['label'])) {
        $complete_field_array['label'] = ucfirst($complete_field_array['name']);
    }
...
1

There are 1 answers

0
tabacitu On BEST ANSWER

Your code worked for me.

enter image description here

Are you sure you didn't miss a paranthesis at the end?

{"name":"value","label":"Value", "title":"Lightbox" ,"type":"select_from_array", "options":{"lightbox":"lightbox","colorbox1":"colorbox1"}}