Symfony i18n 字段和管理生成器
我使用 symfony 1.4.15 与主义。我有模块,有两个 i18n 字段。所以在我的形式课上我做了:
$this->languages = sfConfig::get('app_cultures_enabled');
$langs = array_keys($this->languages);
$this->embedI18n($langs);
foreach($this->languages as $lang => $label)
{
$this->widgetSchema[$lang]['name'] = new sfWidgetFormTextarea(array(), array('cols'=>40,'rows'=>2));
$this->widgetSchema[$lang]['description'] = new sfWidgetFormTextarea(array(), array('cols'=>80,'rows'=>5));
}
而且它工作完美! 但我的表单中有很多字段,所以我需要在表单中创建一些“组”。所以我在我的 generator.yml 中进行下一步:
config:
form:
display:
Main info:[active,position,сoverage_id,basis_id,durability_id,comfort_id,weight_coating,thickness_coating,height_of_pile,segment_id,width_rolls_one,width_rolls_two,width_rolls_three,standart_width_rolls,max_width_rolls,min_width_rolls]
Price: [price,margin_on_roll,margin_on_cutting,special_discount,discount_for_residues]
Market: [certificate]
并且我无法显示两个 i18n 字段“名称”和“描述”。我尝试 市场:[name_i18n] 和 name_i18n_uk 等等。那么是否可以制作?如果没有,还有其他方法可以以表格形式进行分组吗?
谢谢你!
I use symfony 1.4.15 with doctrine. I have module and there are two i18n field. So in my form class I make:
$this->languages = sfConfig::get('app_cultures_enabled');
$langs = array_keys($this->languages);
$this->embedI18n($langs);
foreach($this->languages as $lang => $label)
{
$this->widgetSchema[$lang]['name'] = new sfWidgetFormTextarea(array(), array('cols'=>40,'rows'=>2));
$this->widgetSchema[$lang]['description'] = new sfWidgetFormTextarea(array(), array('cols'=>80,'rows'=>5));
}
And it is work perfect!
But I have many fields in my form, so I need to make some "groups" in my form. So I make next in my generator.yml:
config:
form:
display:
Main info:[active,position,сoverage_id,basis_id,durability_id,comfort_id,weight_coating,thickness_coating,height_of_pile,segment_id,width_rolls_one,width_rolls_two,width_rolls_three,standart_width_rolls,max_width_rolls,min_width_rolls]
Price: [price,margin_on_roll,margin_on_cutting,special_discount,discount_for_residues]
Market: [certificate]
And I can not display two i18n field "name" and "description". I try
Market: [name_i18n] and name_i18n_uk and many other. So is is to possible to make?If not are there other way to group filed in form?
Thank you!
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
你可以在生成器中做这样的事情:
What you can do is something like this in the generator: