bukashk0zzz / booleantype-bundle
一个简单的Symfony扩展包,用于添加布尔形式字段类型。
v2.1.0
2021-12-10 08:44 UTC
Requires
- php: >=7.2
- symfony/config: ^5.0|^6.0
- symfony/dependency-injection: ^5.0|^6.0
- symfony/form: ^5.0|^6.0
- symfony/http-kernel: ^5.0|^6.0
- symfony/yaml: ^5.0|^6.0
Requires (Dev)
- friendsofphp/php-cs-fixer: ^3.0
- phpunit/phpunit: ^7.5
- slevomat/coding-standard: ^5.0
This package is auto-updated.
Last update: 2024-09-10 14:56:30 UTC
README
关于
一个简单的Symfony扩展包,用于添加布尔形式字段类型。
Symfony Flex安装
composer config extra.symfony.allow-contrib true
composer require bukashk0zzz/booleantype-bundle
无Symfony Flex安装
composer require bukashk0zzz/booleantype-bundle
将扩展包添加到app/AppKernel.php
$bundles = array( // ... other bundles new Bukashk0zzz\BooleanTypeBundle\Bukashk0zzzBooleanTypeBundle(), );
配置
不需要。
使用方法
在FormType中使用
class AccountProfileType extends AbstractType { public function buildForm(FormBuilderInterface $builder, array $options) { $builder ->add('nameFirst', TextType::class, ['label' => 'First Name']) ->add('nameLast', TextType::class, ['label' => 'Last Name']) ->add('active', BooleanType::class, [ 'label' => 'User active?', 'required' => false, ]) ; } }