0

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']);
    }
...
4

1 回答 1

1

你的代码对我有用。

在此处输入图像描述

你确定你最后没有漏掉一个括号吗?

{"name":"value","label":"Value", "title":"Lightbox" ,"type":"select_from_array", "options":{"lightbox":"lightbox","colorbox1":"colorbox1"}}
于 2016-12-26T14:36:28.127 回答