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

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