src/AdminBundle/Admin/Founders/GalleryVideoAdmin.php line 14

Open in your IDE?
  1. <?php
  2. namespace AdminBundle\Admin\Founders;
  3. use AdminBundle\Admin\BaseAdmin;
  4. use Sonata\AdminBundle\Datagrid\ListMapper;
  5. use Sonata\AdminBundle\Form\FormMapper;
  6. use Sonata\MediaBundle\Form\Type\MediaType;
  7. use Symfony\Component\Form\Extension\Core\Type\CheckboxType;
  8. use Symfony\Component\Form\Extension\Core\Type\ChoiceType;
  9. use Symfony\Component\Form\Extension\Core\Type\DateType;
  10. use Symfony\Component\Form\Extension\Core\Type\NumberType;
  11. class GalleryVideoAdmin extends BaseAdmin
  12. {
  13.     protected function configureListFields(ListMapper $list): void
  14.     {
  15.         $list->addIdentifier('id')
  16.             ->add('title'null, ['label' => 'Заголовок'])
  17.             ->add('created'null, ['label' => 'Створенний'])
  18.             ->add('position'null, ['label' => 'Позиція'])
  19.             ->add('state',ChoiceType::class, ['label' => 'Відображати на сайті''editable' => true'choices' => [
  20.                 => 'Так',
  21.                 => 'Ні',
  22.             ]])
  23.             ->add('_action''actions', [
  24.                 'label' => 'Дії',
  25.                 'actions' => [
  26.                     'edit' => []
  27.                 ]
  28.             ]);
  29.     }
  30.     protected function configureFormFields(FormMapper $form): void
  31.     {
  32.         $form->add('title'null, ['label' => 'Заголовок''required' => false])
  33.             ->add('video'null, ['label' => 'Посилання на відео'])
  34.             ->add('image_preview'MediaType::class, [
  35.                 'label' => 'Попередній перегляд',
  36.                 'provider' => 'sonata.media.provider.image',
  37.                 'context'  => 'dc_site'
  38.             ])
  39.             ->add('state'CheckboxType::class, ['label' => 'Відображати на сайті''required' => false])
  40.             ->add('position'NumberType::class, [
  41.                 'label' => 'Порядок виводу',
  42.                 'required' => true,
  43.             ])
  44.             ->add('created'DateType::class, ['label' => 'Дата створення''widget' => 'single_text',])
  45.             ->end();
  46.     }
  47. }