Skip to content

A simple Symfony bundle that adds boolean form field type

License

Notifications You must be signed in to change notification settings

Bukashk0zzz/BooleanTypeBundle

Repository files navigation

Symfony BooleanType Bundle

Build Status Code Coverage Scrutinizer Code Quality License Latest Stable Version Total Downloads

About

A simple Symfony bundle that adds boolean form field type.

Installation Symfony Flex

composer config extra.symfony.allow-contrib true
composer require bukashk0zzz/booleantype-bundle

Installation without Symfony Flex

composer require bukashk0zzz/booleantype-bundle

Add the bundle to app/AppKernel.php

$bundles = array(
	// ... other bundles
	new Bukashk0zzz\BooleanTypeBundle\Bukashk0zzzBooleanTypeBundle(),
);

Configuration

Not needed.

Usage

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,
            ])
        ;
    }
}

Copyright / License

See LICENSE

About

A simple Symfony bundle that adds boolean form field type

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages