src/Form/ProjectIntroType.php line 13

Open in your IDE?
  1. <?php
  2. namespace App\Form;
  3. use App\Entity\Project;
  4. use Symfony\Component\Form\AbstractType;
  5. use Symfony\Component\Form\Extension\Core\Type\NumberType;
  6. use Symfony\Component\Form\Extension\Core\Type\SubmitType;
  7. use Symfony\Component\Form\Extension\Core\Type\TextType;
  8. use Symfony\Component\Form\FormBuilderInterface;
  9. use Symfony\Component\OptionsResolver\OptionsResolver;
  10. class ProjectIntroType extends AbstractType
  11. {
  12.     public function buildForm(FormBuilderInterface $builder, array $options): void
  13.     {
  14.         $builder
  15.             ->add('name'TextType::class, [
  16.                 'label' => 'project.new_project.name',
  17.                 'help' => 'project.new_project.name_help',
  18.                 'required' => true,
  19.             ])
  20.             ->add('electricityCostPerUnit'NumberType::class,
  21.                 [
  22.                     'label' => 'project.new_project.electricity_cost_per_unit',
  23.                     'help' => 'project.new_project.electricity_cost_per_unit_help',
  24.                     'required' => true,
  25.                 ]
  26.             )
  27.             ->add('continue'SubmitType::class, [
  28.                 'label' => 'project.new_project.submit',
  29.             ])
  30.         ;
  31.     }
  32.     public function configureOptions(OptionsResolver $resolver): void
  33.     {
  34.         $resolver->setDefaults([
  35.             'data_class' => Project::class,
  36.         ]);
  37.     }
  38. }