Nevar pievienot vairāk kā 25 tēmas Tēmai ir jāsākas ar burtu vai ciparu, tā var saturēt domu zīmes ('-') un var būt līdz 35 simboliem gara.

36 rindas
1.1KB

  1. <?php
  2. namespace Lc\CaracoleBundle\Controller\Common;
  3. use EasyCorp\Bundle\EasyAdminBundle\Config\Crud;
  4. use EasyCorp\Bundle\EasyAdminBundle\Field\IntegerField;
  5. use EasyCorp\Bundle\EasyAdminBundle\Field\NumberField;
  6. use EasyCorp\Bundle\EasyAdminBundle\Field\TextField;
  7. use Lc\CaracoleBundle\Controller\Admin\AbstractCrudController;
  8. abstract class TaxRateCrudController extends AbstractCrudController
  9. {
  10. public function configureCrud(Crud $crud): Crud
  11. {
  12. return $crud->setSearchFields(['id', 'title', 'value']);
  13. }
  14. public function configureFields(string $pageName): iterable
  15. {
  16. $id = IntegerField::new('id', 'ID');
  17. $title = TextField::new('title');
  18. $value = NumberField::new('value');
  19. if (Crud::PAGE_INDEX === $pageName) {
  20. return [$id, $title, $value];
  21. } elseif (Crud::PAGE_DETAIL === $pageName) {
  22. return [$id, $title, $value];
  23. } elseif (Crud::PAGE_NEW === $pageName) {
  24. return [$title, $value];
  25. } elseif (Crud::PAGE_EDIT === $pageName) {
  26. return [$title, $value];
  27. }
  28. }
  29. }