kamran / group-choice-list-bundle
此包提供了分组选择列表表单字段
dev-master
2015-10-26 06:49 UTC
Requires
- php: >=5.4
- sensio/framework-extra-bundle: ~3.0,>=3.0.2
This package is not auto-updated.
Last update: 2024-09-24 07:37:06 UTC
README
描述
此包提供了分组选择列表(选项)自定义表单类型。
安装。
使用 composer
$ composer require kamran/groupchoicelist-bundle dev-master
将 GroupChoiceListBundle 添加到您的 AppKernel.php 文件中
new Kamran\GroupChoiceListBundle\KamranGroupChoiceListBundle();
如何使用?
GroupChoiceList 提供了一种表单类型,可以以分组格式显示多个选择。您可以在表单中使用 'groupchoicelist' 类型。
// form_file.php public function buildForm(FormBuilderInterface $builder, array $options) { // add group_choice_list as a form type in your form $builder->add('tags','groupchoicelist',array( 'label'=>'Tags', 'choice_list' => $data_array, 'entity_class' => 'KamranTagsBundle:Tags' )); }
* `choice_list` : This takes array data in proper format which is given below.
* `entity_class`: Set entity class
* `list_type`: 'checkbox' for group of checkboxes (default), 'radiobutton' for group of radiobuttons
// data array format for 'choice_list' option $data_array = array( array( 'group' => array('id'=>1,'title'=>'PHP'), 'options' => array(1=>'Symfony',2=>'Laravel',3=>'Wordpress',4=>'Magento',5=>'Drupal') ), array( 'group' => array('id'=>2,'title'=>'Javascript'), 'options' => array(6=>'JQuery',7=>'NodeJS',8=>'BackboneJS',9=>'AngularJS',10=>'UnderscoreJS') ), array( 'group' => array('id'=>3,'title'=>'Python'), 'options' => array(11=>'Django',12=>'Flask') ), );
报告问题或功能请求。
问题和功能请求在 Github issue tracker 中跟踪。
如何贡献?
此包对公众的贡献是开放的,任何人都可以帮助我参与错误报告、文档和代码。
许可证。
此软件是根据 MIT 许可证授权的。请参阅包中的完整许可证文件。
Resources/meta/LICENSE