src/AdminBundle/Admin/VidiFounders/FoundersAdmin.php line 11

Open in your IDE?
  1. <?php
  2. namespace AdminBundle\Admin\VidiFounders;
  3. use AdminBundle\Admin\BaseAdmin;
  4. use FOS\CKEditorBundle\Form\Type\CKEditorType;
  5. use Sonata\AdminBundle\Datagrid\ListMapper;
  6. use Sonata\AdminBundle\Form\FormMapper;
  7. use Sonata\MediaBundle\Form\Type\MediaType;
  8. class FoundersAdmin extends BaseAdmin
  9. {
  10.     protected function configureListFields(ListMapper $list): void
  11.     {
  12.         $list->addIdentifier('id')
  13.             ->add('title_ua'null, ['label' => 'Заголовок'])
  14.             ->add('_action''actions', [
  15.                 'label' => 'Действия',
  16.                 'actions' => [
  17.                     'edit' => []
  18.                 ]
  19.         ]);
  20.     }
  21.     protected function configureFormFields(FormMapper $form): void
  22.     {
  23.         $form->add('title_ua'null, ['label' => 'Заголовок UA''required' => true])
  24.             ->add('title_ru'null, ['label' => 'Заголовок RU''required' => true])
  25.             ->add('text_ua'CKEditorType::class, ['label' => 'Текст UA''required' => true])
  26.             ->add('text_ru'CKEditorType::class, ['label' => 'Текст RU''required' => true])
  27.             ->add('image'MediaType::class, [
  28.                 'label' => 'Зображення',
  29.                 'required' => true,
  30.                 'provider' => 'sonata.media.provider.image',
  31.                 'context'  => 'dc_site'
  32.             ])
  33.             ->add('image_mobile'MediaType::class, [
  34.                 'label' => 'Зображення мобільне',
  35.                 'required' => true,
  36.                 'provider' => 'sonata.media.provider.image',
  37.                 'context'  => 'dc_site'
  38.             ])
  39.             ->end();
  40.     }
  41. }