colinfrei/bitfield-type-bundle
最新稳定版本:2.7.0
Composer 安装命令:
composer require colinfrei/bitfield-type-bundle
包简介
Adds a bitfield type to use in Symfony Forms
README 文档
README
Installation
Add the following to your deps file:
[ColinFreiBitFieldFormTypeBundle]
git=http://github.com/colinfrei/Symfony-Bitfield-Form-Type-Bundle.git
target=bundles/ColinFrei/BitFieldTypeBundle
Register the ColinFrei namespace in the app/autoload.php file, by adding this line in the $loader->registerNamespaces(array( array:
'ColinFrei' => __DIR__.'/../vendor/bundles',
Register the bundle in your app/AppKernel.php file, by adding this line in the bundles array in the registerBundles() function:
new ColinFrei\BitFieldTypeBundle\ColinFreiBitFieldTypeBundle(),
Usage
Use the BitfieldType class when adding fields to the form, and pass in an array of options, like the type line in this example from the Symfony documentation:
use ColinFrei\BitFieldTypeBundle\Form\Type\BitfieldType;
$form = $this->createFormBuilder($task)
->add('task', 'text')
->add('dueDate', 'date')
->add('type', BitfieldType::class, array(
'choices' => array('Annoying' => '1', 'Fun' => '2', 'Cool' => '4', 'Takes a while' => '8'),
'choices_as_values' => true
)
->getForm();
统计信息
- 总下载量: 7.42k
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 4
- 点击次数: 1
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2012-11-19