src/AdminBundle/Admin/Shop/GroupAdmin.php line 16

Open in your IDE?
  1. <?php
  2. namespace AdminBundle\Admin\Shop;
  3. use Sonata\AdminBundle\Admin\AbstractAdmin;
  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. /**
  9.  * Class GroupAdmin
  10.  * @package AdminBundle\Admin\Shop
  11.  */
  12. class GroupAdmin extends AbstractAdmin
  13. {
  14.     /**
  15.      * @param RouteCollectionInterface $collection
  16.      */
  17.     protected function configureRoutes(RouteCollectionInterface $collection): void
  18.     {
  19.         $collection->remove('delete');
  20.     }
  21.     /**
  22.      * @param FormMapper $formMapper
  23.      */
  24.     protected function configureFormFields(FormMapper $formMapper): void
  25.     {
  26.         $formMapper
  27.             ->with('Название категории', ['class' => 'col-md-6'])
  28.             ->add('title_ru',TextType::class, ['label' => 'Название группы (RU)''required' => false])
  29.             ->add('title_ua',TextType::class, ['label' => 'Название группы (UA)''required' => false])
  30.             ->end()
  31.         ;
  32.     }
  33.     /**
  34.      * @param ListMapper $listMapper
  35.      */
  36.     protected function configureListFields(ListMapper $listMapper): void
  37.     {
  38.         $listMapper
  39.             ->addIdentifier('id')
  40.             ->add('title_ru',TextType::class, ['label' => 'Имя категории'])
  41.             ->add('_action''actions', [
  42.                 'label' => 'Действия',
  43.                 'actions' => [
  44.                     'edit' => [],
  45.                 ]
  46.             ])
  47.         ;
  48.     }
  49. }