| 1: | <?php |
| 2: | namespace TIC\DemoBundle\Form; |
| 3: | |
| 4: | use TIC\CoreBundle\Base\TICFormType as BaseType; |
| 5: | use Symfony\Component\Form\FormBuilderInterface; |
| 6: | |
| 7: | use Symfony\Component\Form\Extension\Core\Type\TextType; |
| 8: | use Symfony\Component\Form\Extension\Core\Type\TextareaType; |
| 9: | use Symfony\Component\Form\Extension\Core\Type\UrlType; |
| 10: | use Symfony\Component\Form\Extension\Core\Type\EmailType; |
| 11: | use Symfony\Component\Form\Extension\Core\Type\TelType; |
| 12: | use Symfony\Component\Form\Extension\Core\Type\ColorType; |
| 13: | use Symfony\Component\Form\Extension\Core\Type\PasswordType; |
| 14: | |
| 15: | use Symfony\Component\Form\Extension\Core\Type\NumberType; |
| 16: | use Symfony\Component\Form\Extension\Core\Type\IntegerType; |
| 17: | use Symfony\Component\Form\Extension\Core\Type\MoneyType; |
| 18: | use Symfony\Component\Form\Extension\Core\Type\PercentType; |
| 19: | use Symfony\Component\Form\Extension\Core\Type\RangeType; |
| 20: | |
| 21: | use Symfony\Component\Form\Extension\Core\Type\DateType; |
| 22: | use Symfony\Component\Form\Extension\Core\Type\DateTimeType; |
| 23: | use Symfony\Component\Form\Extension\Core\Type\BirthdayType; |
| 24: | use Symfony\Component\Form\Extension\Core\Type\TimeType; |
| 25: | use Symfony\Component\Form\Extension\Core\Type\WeekType; |
| 26: | use Symfony\Component\Form\Extension\Core\Type\DateIntervalType; |
| 27: | |
| 28: | |
| 29: | |
| 30: | |
| 31: | class CrudObjectType extends BaseType |
| 32: | { |
| 33: | |
| 34: | public function buildForm(FormBuilderInterface $builder, array $options) |
| 35: | { |
| 36: | $builder |
| 37: | ->add('name', TextType::class, [ |
| 38: | 'label' => true, |
| 39: | 'attr' => [ |
| 40: | 'placeholder' => "Nom...", |
| 41: | ] |
| 42: | ]) |
| 43: | ->add('category', TextType::class, [ |
| 44: | 'label' => true, |
| 45: | 'attr' => [ |
| 46: | 'placeholder' => true, |
| 47: | 'prefix' => "[REF]", |
| 48: | 'suffix' => "test", |
| 49: | ] |
| 50: | ]) |
| 51: | ->add('description', TextareaType::class, [ |
| 52: | 'required' => false, |
| 53: | 'label' => false, |
| 54: | ]) |
| 55: | ->add('comment', TextareaType::class, [ |
| 56: | 'required' => false, |
| 57: | 'label' => true, |
| 58: | ]) |
| 59: | ->add('score', NumberType::class, [ |
| 60: | 'required' => false, |
| 61: | 'label' => true, |
| 62: | ]) |
| 63: | ->add('quantity', IntegerType::class, [ |
| 64: | 'required' => false, |
| 65: | 'label' => true, |
| 66: | ]) |
| 67: | ->add('price', MoneyType::class, [ |
| 68: | 'required' => false, |
| 69: | 'label' => true, |
| 70: | 'attr' => [ |
| 71: | 'prefix' => true, |
| 72: | 'suffix' => true, |
| 73: | ], |
| 74: | ]) |
| 75: | ->add('since', BirthdayType::class, [ |
| 76: | 'required' => false, |
| 77: | 'label' => true, |
| 78: | ]) |
| 79: | ->add('publishedAt', DateTimeType::class, [ |
| 80: | 'required' => false, |
| 81: | 'label' => true, |
| 82: | ]) |
| 83: | |
| 84: | ->add('email', EmailType::class, [ |
| 85: | 'required' => false, |
| 86: | 'mapped' => false, |
| 87: | 'label' => true, |
| 88: | 'attr' => [ |
| 89: | 'prefix' => "@", |
| 90: | 'suffix' => true, |
| 91: | ], |
| 92: | ]) |
| 93: | ->add('phone', TelType::class, [ |
| 94: | 'required' => false, |
| 95: | 'mapped' => false, |
| 96: | 'label' => true, |
| 97: | 'attr' => [ |
| 98: | 'prefix' => true, |
| 99: | 'suffix' => true, |
| 100: | ], |
| 101: | ]) |
| 102: | ->add('website', UrlType::class, [ |
| 103: | 'required' => false, |
| 104: | 'mapped' => false, |
| 105: | 'label' => true, |
| 106: | 'attr' => [ |
| 107: | 'prefix' => true, |
| 108: | 'suffix' => true, |
| 109: | ], |
| 110: | ]) |
| 111: | ->add('color', ColorType::class, [ |
| 112: | 'required' => false, |
| 113: | 'mapped' => false, |
| 114: | 'label' => true, |
| 115: | 'attr' => [ |
| 116: | 'prefix' => true, |
| 117: | 'suffix' => true, |
| 118: | ], |
| 119: | ]) |
| 120: | ->add('secret', PasswordType::class, [ |
| 121: | 'required' => false, |
| 122: | 'mapped' => false, |
| 123: | 'label' => true, |
| 124: | 'attr' => [ |
| 125: | 'prefix' => true, |
| 126: | 'suffix' => true, |
| 127: | ], |
| 128: | ]) |
| 129: | ->add('rate', PercentType::class, [ |
| 130: | 'required' => false, |
| 131: | 'mapped' => false, |
| 132: | 'label' => true, |
| 133: | ]) |
| 134: | ->add('range', RangeType::class, [ |
| 135: | 'required' => false, |
| 136: | 'mapped' => false, |
| 137: | 'label' => true, |
| 138: | ]) |
| 139: | ; |
| 140: | } |
| 141: | |
| 142: | } |
| 143: | |