src/AdminBundle/Admin/References/FeatureGroupAdmin.php line 12

Open in your IDE?
  1. <?php
  2. namespace AdminBundle\Admin\References;
  3. use AdminBundle\Admin\BaseAdmin;
  4. use Sonata\AdminBundle\Datagrid\ListMapper;
  5. use Sonata\AdminBundle\Form\FormMapper;
  6. use Sonata\AdminBundle\Route\RouteCollectionInterface;
  7. use Symfony\Component\Form\Extension\Core\Type\TextType;
  8. class FeatureGroupAdmin extends BaseAdmin
  9. {
  10.     /**
  11.      * @param RouteCollectionInterface $collection
  12.      */
  13.     protected function configureRoutes(RouteCollectionInterface $collection): void
  14.     {
  15.         $collection->remove('view');
  16.     }
  17.     /**
  18.      * @param FormMapper $formMapper
  19.      */
  20.     protected function configureFormFields(FormMapper $formMapper): void
  21.     {
  22.         $formMapper
  23.             ->with('Название категории', ['class' => 'col-md-6'])
  24.                 ->add('name_ru',TextType::class, ['label' => 'Название группы (RU)''required' => false])
  25.                 ->add('name_ua',TextType::class, ['label' => 'Название группы (UA)''required' => false])
  26.             ->end()
  27.         ;
  28.     }
  29.     /**
  30.      * @param ListMapper $listMapper
  31.      */
  32.     protected function configureListFields(ListMapper $listMapper): void
  33.     {
  34.         $listMapper
  35.             ->addIdentifier('id')
  36.             ->add('name_ru',TextType::class, ['label' => 'Имя категории'])
  37.             ->add('_action''actions', [
  38.                 'label' => 'Действия',
  39.                 'actions' => [
  40.                     'edit' => [],
  41.                 ]
  42.             ])
  43.         ;
  44.     }
  45. }