您最多选择25个主题 主题必须以字母或数字开头,可以包含连字符 (-),并且长度不得超过35个字符

31 行
1.0KB

  1. <?php
  2. namespace Lc\SovBundle\Field;
  3. use EasyCorp\Bundle\EasyAdminBundle\Contracts\Field\FieldInterface;
  4. use EasyCorp\Bundle\EasyAdminBundle\Field\FieldTrait;
  5. use Lc\SovBundle\Form\Type\FileManagerType;
  6. use Symfony\Component\Form\Extension\Core\Type\ChoiceType;
  7. use Symfony\Component\Form\Extension\Core\Type\TextType;
  8. /**
  9. * @author La clic ! <contact@laclic.fr>
  10. */
  11. final class BooleanField implements FieldInterface
  12. {
  13. use FieldTrait;
  14. public static function new(string $propertyName, ?string $label = null): self
  15. {
  16. return (new self())
  17. ->setProperty($propertyName)
  18. ->setLabel($label)
  19. ->setTemplatePath('@LcSov/adminlte/crud/field/toggle.html.twig')
  20. ->setFormType(ChoiceType::class)
  21. ->setFormTypeOption('expanded', false)
  22. ->setFormTypeOption('multiple', false)
  23. ->setFormTypeOption('choices', ['En ligne' => 1, 'Hors ligne' => 0]);
  24. }
  25. }