A simple Symfony bundle that adds boolean form field type.
composer config extra.symfony.allow-contrib true
composer require bukashk0zzz/booleantype-bundle
composer require bukashk0zzz/booleantype-bundle
Add the bundle to app/AppKernel.php
$bundles = array(
// ... other bundles
new Bukashk0zzz\BooleanTypeBundle\Bukashk0zzzBooleanTypeBundle(),
);
Not needed.
Inside a 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,
])
;
}
}
See LICENSE