src/Form/NoticeType.php line 12

Open in your IDE?
  1. <?php
  2. namespace App\Form;
  3. use Symfony\Component\Form\AbstractType;
  4. use Symfony\Component\Form\FormBuilderInterface;
  5. use Symfony\Component\Form\Extension\Core\Type\TextType;
  6. /**
  7.  *
  8.  * @author wendell.zheng <wxzheng@ustc.edu.cn>
  9.  */
  10. class NoticeType extends AbstractType
  11. {
  12.     public function buildForm(FormBuilderInterface $builder, array $options)
  13.     {
  14.         $builder->add('batch'null, [
  15.             'label' => '批次',
  16.             'disabled' => true
  17.         ])->add('name'TextType::class, [
  18.             'label' => '标题',
  19.             'required' => true
  20.         ])
  21.             ->add('publishedAt'null, [
  22.             'label' => '发布日期',
  23.             'widget' => 'single_text',
  24.             'data' => new \DateTime()
  25.         ])
  26.             ->add('content'null, [
  27.             'label' => '内容'
  28.         ]);
  29.     }
  30. }