Prestashop:使用多语言字段帮助执行

Prestashop:使用多语言字段帮助执行,prestashop,prestashop-1.6,Prestashop,Prestashop 1.6,我使用Helperform的地方。我想让一些字段可以翻译。我添加了以下表格: $fields_form = array( 'form' => array( 'legend' => array( 'title' => $this->l('Diplom hinzufügen'), 'icon' => 'icon-question'

我使用Helperform的地方。我想让一些字段可以翻译。我添加了以下表格:

        $fields_form = array(
        'form' => array(
            'legend' => array(
                'title' => $this->l('Diplom hinzufügen'),
                'icon' => 'icon-question'
            ),
            'input' => array(
                array(
                    'type' => 'text',
                    'label' => $this->l('Name'),
                    'name' => 'name',
                    'lang' => true,
                ),
            ),
            'submit' => array('title' => $this->l('Save'))
        )
    );
    $helper = new HelperForm();
    $helper->submit_action = 'saveDiplom';
    $helper->currentIndex = $this->context->link->getAdminLink('AdminModules', false).'&configure='.$this->name.'&tab_module='.$this->tab.'&module_name='.$this->name;
    $helper->token = Tools::getAdminTokenLite('AdminModules');


    $helper->tpl_vars = array(
        'fields_value' => array(
            'name' => '',
        ),
    );


    return $helper->generateForm(array($fields_form));
我在后台没有看到“name”字段。怎么了?如果我删除'lang'=>true,它就会显示出来。
是否需要任何其他设置(如在构造函数中)?

这是标准的帮助执行初始化:

$helper = new HelperForm();
$helper->show_toolbar             = false;
$helper->table                    = $this->table;
$helper->module                   = $this;
$helper->default_form_language    = $this->context->language->id;
$helper->allow_employee_form_lang = Configuration::get('PS_BO_ALLOW_EMPLOYEE_FORM_LANG', 0);

$helper->identifier    = $this->identifier;
$helper->submit_action = 'submitNameOfModuleModule';
$helper->currentIndex  = $this->context->link->getAdminLink('AdminModules', false)
                         . '&configure=' . $this->name . '&tab_module=' . $this->tab . '&module_name=' . $this->name;
$helper->token         = Tools::getAdminTokenLite('AdminModules');

$helper->tpl_vars = array(
    'fields_value' => $this->getConfigFormValues(), /* Add values for your inputs, in your case you have passed the array directly */
    'languages'    => $this->context->controller->getLanguages(),
    'id_language'  => $this->context->language->id,
);
我猜你忘了
tpl\u vars
数组中的“语言”和
id\u语言


也许这会有帮助。

谢谢@sarcom这对我帮助很大!抱歉,我完全忘记检查文档(仅使用谷歌),通常它们没有帮助:P@EmanuelSchiendorfer不客气;),我很高兴这有帮助:)