Prestashop-字段\仅添加单个字符的值
我对prestashop和form helper有问题。我有两个输入文本的表单,我可以添加默认值和字段值。不幸的是,它不起作用。我的表格:Prestashop-字段\仅添加单个字符的值,prestashop,prestashop-1.6,prestashop-1.7,Prestashop,Prestashop 1.6,Prestashop 1.7,我对prestashop和form helper有问题。我有两个输入文本的表单,我可以添加默认值和字段值。不幸的是,它不起作用。我的表格: public function displayForm() { $default_lang = (int)Configuration::get('PS_LANG_DEFAULT'); $fields_form = array(); $fields_form[0]['form'] = array( 'legend' =&
public function displayForm()
{
$default_lang = (int)Configuration::get('PS_LANG_DEFAULT');
$fields_form = array();
$fields_form[0]['form'] = array(
'legend' => array(
'title' => $this->l('My module settings')
),
'input' => array(
array(
'type' => 'text',
'label' => $this->l('Box Description: '),
'name' => 'description',
'lang' => true,
),
array(
'type' => 'text',
'label' => $this->l('Box Description: '),
'name' => 'test_name',
'lang' => true,
)
),
'submit' => array(
'title' => $this->l('Save'),
'class' => 'btn btn-default pull-right'
)
);
$languages = Language::getLanguages();
$helper = new HelperForm();
$helper->module = $this;
$helper->name_controller = $this->name;
$helper->currentIndex = AdminController::$currentIndex.'&configure='.$this->name;
$helper->token = Tools::getAdminTokenLite('AdminModules');
$helper->default_form_language = $default_lang;
$helper->allow_employee_form_lang = $default_lang;
$helper->languages = $this->context->controller->getLanguages();
$helper->title = $this->l('tester2');
$helper->show_toolbar = true; // false -> remove toolbar
$helper->toolbar_scroll = true; // yes - > Toolbar is always visible on the top of the screen.
$helper->submit_action = 'homepage_settings';
$helper->tpl_vars = array(
'fields_value' => array('description' => $this->l('hello'), 'test_name' => 'tester2'),
'languages' => $this->context->controller->getLanguages(),
'id_language' => $this->context->language->id
);
return $helper->generateForm($fields_form);
}
当我安装模块并转到模块配置时,我会看到2个表单输入文本,其中包含单个字符,而不是我的文本
我做错了什么?下一个问题是我能做什么,我的模块,使我的模块工作在多存储模式?在最终版本中,表单中的数据将从数据库中得到补充,但我想找出它为什么不能用全文完成字段。您的字段是多语言的 试试这个:
'fields_value' => array(
'description' => array(1 => $this->l('hello')), 'test_name' => array(1 => 'tester2')),
工作正常:)但如何添加对多语言字段的支持?第二天我正在寻找解决方案,但我无法管理:(我想将这些字段设置为多语言,并以这种形式保存到数据库中。