Warning: You are browsing the documentation for PrestaShop 1.7, which is outdated.
You might want to read an updated version of this page for the current version, PrestaShop 9. Read the updated version of this page
The YesAndNoChoiceType represents select input with options Yes and No.
| Option | Type | Default | Description |
|---|---|---|---|
| choices | array | array | By default Yes/No choices are defined |
| required | boolean | false | Whether field is required or not |
None.
Add YesAndNoChoiceType to your form.
<?php
use Symfony\Component\Form\AbstractType;
use PrestaShopBundle\Form\Admin\Type\YesAndNoChoiceType;
class SomeType extends AbstractType
{
public function buildForm(FormBuilderInterface $builder, array $options)
{
$builder->add('yesandnochoicetype', YesAndNoChoiceType::class, [
'choices' => [
'Yes' => true,
'No' => false,
],
]);
}
}
