<?php

namespace Lc\SovBundle\Field;

use EasyCorp\Bundle\EasyAdminBundle\Contracts\Field\FieldInterface;
use EasyCorp\Bundle\EasyAdminBundle\Field\FieldTrait;
use Symfony\Component\Form\Extension\Core\Type\CheckboxType;

/**
 * @author La clic ! <contact@laclic.fr>
 */
final class ToggleField implements FieldInterface
{
        use FieldTrait;

        public static function new(string $propertyName, ?string $label = null): self
        {
                return (new self())
                        ->setProperty($propertyName)
                        ->setLabel($label)
                        ->setTemplatePath('@LcSov/adminlte/crud/field/toggle.html.twig')
                        ->setFormType(CheckboxType::class);
        }

}