Nie możesz wybrać więcej, niż 25 tematów Tematy muszą się zaczynać od litery lub cyfry, mogą zawierać myślniki ('-') i mogą mieć do 35 znaków.

36 lines
1.1KB

  1. <?php
  2. namespace Lc\CaracoleBundle\Controller\Config;
  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\AbstractAdminController;
  8. abstract class TaxRateAdminController extends AbstractAdminController
  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. }