下拉列表只显示一个字母Prestashop

时间:2017-11-01 06:05:00

标签: javascript php css prestashop prestashop-1.7

我正在开发一个prestashop模块。在我的控制器renderForm中,我有下拉列表来加载工作日。但它只显示当天的第一个字母。

    public function renderForm() {

$days=["Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"];

    'input' => [

                    [
                      'type' => 'select',
                        'lang' => true,
                        'required' => true,
                        'label' => $this->l('WeekDay'),
                        'name' => 'weekday',
                        'options' => [
                          'query' => $days,

                        ],

                    ],
         ]
    }

显示如下

enter image description here

检查元素

Inspect

1 个答案:

答案 0 :(得分:0)

根据prestashop 1.7文档,您的query值应符合以下格式。

$days = array(
  array(
    'id' => 1,        // The value of the 'value' attribute of the <option> tag.
    'name' => $this->trans('Monday', array(), 'Admin.International.Feature') // The value of the text content of the  <option> tag.
  ),
  array(
    'id' => 2,
    'name' => $this->trans('Tuesday', array(), 'Admin.International.Feature')
  ),
);