Bläddra i källkod

status field no null value

feature/ticket
Charly 3 år sedan
förälder
incheckning
9ca327ac1c
1 ändrade filer med 22 tillägg och 21 borttagningar
  1. +22
    -21
      Field/StatusField.php

+ 22
- 21
Field/StatusField.php Visa fil

@@ -13,27 +13,28 @@ use Symfony\Component\Form\Extension\Core\Type\TextType;
*/
final class StatusField implements FieldInterface
{
use FieldTrait;

public static function new(string $propertyName, ?string $label = null, bool $templateToggle = true): self
{
$field = (new self())
->setProperty($propertyName)
->setLabel($label)
->setFormType(ChoiceType::class)
->setFormTypeOption('expanded', true)
->setFormTypeOption('multiple', false)
->setFormTypeOption('choices', ['En ligne' => 1, 'Hors ligne' => 0])
->setCustomOption('toggle_label', 'En ligne');

$template = 'toggle.html.twig' ;
if(!$templateToggle) {
$template = 'status.html.twig' ;
}

$field->setTemplatePath('@LcSov/adminlte/crud/field/'.$template) ;

return $field ;
use FieldTrait;

public static function new(string $propertyName, ?string $label = null, bool $templateToggle = true): self
{
$field = (new self())
->setProperty($propertyName)
->setLabel($label)
->setFormType(ChoiceType::class)
->setFormTypeOption('expanded', true)
->setFormTypeOption('multiple', false)
->setFormTypeOption('choices', ['En ligne' => 1, 'Hors ligne' => 0])
->setFormTypeOption('placeholder', false)
->setCustomOption('toggle_label', 'En ligne');

$template = 'toggle.html.twig';
if (!$templateToggle) {
$template = 'status.html.twig';
}

$field->setTemplatePath('@LcSov/adminlte/crud/field/' . $template);

return $field;
}

}

Laddar…
Avbryt
Spara