nitra / e-commerce-admin-nlcollectionbundle
该软件包已被废弃,不再维护。没有建议的替代软件包。
nep admin nlcollection bundle
dev-master
2015-05-12 17:40 UTC
This package is auto-updated.
Last update: 2018-04-27 10:37:46 UTC
README
描述
该捆绑包旨在
- 添加集合类型字段;
- 此类型字段用于某些字段或表单的“集合”可视化。在最简单的情况下,这可以是一个文本字段数组,用于填充邮件数组字段。在更复杂的例子中,您可以插入整个表单,这在创建提供一对一(例如,产品,可以管理许多类似产品照片)的表单时很有用。
连接
- composer.json
{
...
"require": {
...
"nitra/e-commerce-admin-nlcollectionbundle": "dev-master",
...
}
...
}
- app/AppKernel.php
<?php
use Symfony\Component\HttpKernel\Kernel;
use Symfony\Component\Config\Loader\LoaderInterface;
class AppKernel extends Kernel
{
//...
public function registerBundles()
{
//...
$bundles = array(
//...
new Nitra\NlCollectionBundle\NitraNlCollectionBundle(),
//...
);
//...
return $bundles;
}
//...
}
使用
- generator.yml
products:
label: fields.products.label
formType: nlcollection
addFormOptions:
type: genemu_autocomplete
options:
autocomplete_class: NitraProductBundle:Product
allow_add: true
allow_delete: true
delete_empty: true
removing_message: 'удалить?'
- 选项
- type - 将使用的字段类型(text, choice 等)。例如,如果将使用邮件数组,则需要使用字段类型 email。
- allow_add - 布尔选项。如果为 true,则启用添加元素的功能。
- allow_delete - 布尔选项。如果为 true,则启用删除元素的功能。
- delete_empty - 仅从 Symfony 2.5 开始可用。如果您想从表中删除空记录,则必须将此参数设置为 true。然而,现有记录仅在您启用了 allow_delete 参数的情况下才会被删除。否则,空值将被保留。
- removing_message - 输出确认删除的消息。
- options - 选项数组。例如,如果使用字段类型 choice,则选项字段将大致如下所示
'type' => 'choice',
'options' => array(
'choices' => array(
'nashville' => 'Nashville',
'paris' => 'Paris',
'berlin' => 'Berlin',
'london' => 'London',
),
),