ucs / form
UCS 数组表单组件
0.9
2015-06-29 18:53 UTC
Requires
- php: >=5.3.2
- doctrine/collections: 1.2.*
- symfony/event-dispatcher: >=2.4, <3
- symfony/form: >=2.4, <3
- symfony/http-foundation: >=2.4, <3
- symfony/intl: >=2.4, <3
- symfony/options-resolver: >=2.4, <3
- symfony/property-access: >=2.4, <3
- symfony/validator: >=2.4, <3
This package is not auto-updated.
Last update: 2019-09-15 15:55:46 UTC
README
为 Symfony2 提供额外的表单类型
ArrayFormType
这允许您从数组定义中构建表单,这对于从 JSON 加载的自定义表单非常有用。
定义字段如下
<?php $options = array( 'name' => array( 'type' => 'group', // Can be 'item', // If its a group 'items' => array(), // With same construction as this sample // Else 'value' => 'blabhblahblah', 'widget' => array( 'type' => 'text', 'options' => array( 'label' => 'Name', 'help_block' => 'patati patata', 'trans_domain' => 'MyDomain', 'required' => true, 'max_length' => 255, 'constraints' => array( 'length' => array( 'min' => 5, 'max' => 255 ) ) ) ) ) );
约束将被转换为适当的 Symfony2 验证约束,并正确地在 UCS 内部 ConstraintMapping 中注册。