Prestashop 1.6帮助执行将类fixed-width-x1添加到表单选择器
我正在创建一个Prestashops 1.6模块。在helperformselect中添加输入后,然后在html中脚本添加了类fixed-width-x1Prestashop 1.6帮助执行将类fixed-width-x1添加到表单选择器,prestashop,Prestashop,我正在创建一个Prestashops 1.6模块。在helperformselect中添加输入后,然后在html中脚本添加了类fixed-width-x1 $fields_form[0]['form'] = array( 'tinymce' => true, 'legend' => array( 'title' => $this->l('Add rule'),
$fields_form[0]['form'] = array(
'tinymce' => true,
'legend' => array(
'title' => $this->l('Add rule'),
),
'submit' => array(
'name' => 'add',
'title' => $this->l('Add'),
'class' => 'btn btn-default pull-right'
),
'input' => array(
array(
'type' => 'select',
'label' => $this->l('Category'),
'name' => 'category',
'required' => true
),
)
);
为什么它会出错?
我希望添加要选择的自己的类,但fixed-width-x1会覆盖属性宽度。在呈现select的过程中,HelpPerform类会自动添加此类 但是,在我看来,您可以做的是在select中添加一个类,然后在这个新类中更改样式 要将新类添加到select,请仅将其添加到选项数组的末尾:
'class' => 'name-of-custom-class'
确保最后一个选项后的逗号存在
总之,应该是这样的:
$fields_form[0]['form'] = array(
'tinymce' => true,
'legend' => array(
'title' => $this->l('Add rule'),
),
'submit' => array(
'name' => 'add',
'title' => $this->l('Add'),
'class' => 'btn btn-default pull-right'
),
'input' => array(
array(
'type' => 'select',
'label' => $this->l('Category'),
'name' => 'category',
'required' => true,
'class' => 'name-of-custom-class'
),
)
);
希望对你有帮助
[编辑]
HelperForm类使用模板进行此输入。此模板是:
/[admin-folder]/themes/default/template/helpers/form/form.tpl
在第341行附近的文件中,您可以找到以下代码:
{elseif $input.type == 'select'}
{if isset($input.options.query) && !$input.options.query && isset($input.empty_message)}
{$input.empty_message}
{$input.required = false}
{$input.desc = null}
{else}
<select name="{$input.name|escape:'html':'utf-8'}"
class="{if isset($input.class)}{$input.class|escape:'html':'utf-8'}{/if} fixed-width-xl"
{elseif$input.type=='select'}
{if-isset($input.options.query)&&&!$input.options.query&&isset($input.empty_message)}
{$input.empty_message}
{$input.required=false}
{$input.desc=null}
{else}
自定义类的名称固定宽度xl
将字段添加到数组后的类。类fixed-width-x1已重新标记。有什么想法吗?确切地说,这个过程不会替换当前类,只会添加一个新类来指定您需要的样式。但是,类“fixed width xl”有什么问题?这个类有属性width with!重要的。我不想在输入选择器中使用这个类。例如,这个类没有输入文本。谢谢,我也找到了这个文件。现在我在模块中重写此文件,它将正常工作!:)