sectionStore = $sectionStore; $this->productCategoryStore = $productCategoryStore; } public function configureIndex(): array { $fieldArray = ($this->section == null) ? ['section'] : []; return array_merge($fieldArray, [ 'id', 'title', 'position', 'createdAt', 'updatedAt', 'status', 'saleStatus', 'isEligibleTicketRestaurant' ]); } public function configurePanels(): array { return [ 'main', 'seo', 'opengraph', 'conf' ]; } public function configurePanelMain(): array { return [ 'section', 'parent', 'title', 'description', 'image', 'status', 'saleStatus', 'isEligibleTicketRestaurant', ]; } public function configureFields(): array { if(is_null($this->productCategoryArray)) { $this->productCategoryArray = $this->productCategoryStore ->setSection($this->section) ->getParents(); } return [ 'title' => TextField::new('title')->setSortable(true), 'position' => NumberField::new('position')->setSortable(true), 'parent' => AssociationField::new('parent') ->setFormTypeOption('choices', $this->productCategoryArray) ->setFormTypeOption( 'choice_label', function ($productCategory) { return $productCategory->getTitle() . ' (' . $productCategory->getSection() . ')'; } ), 'image' => ImageManagerField::new('image'), 'description' => CKEditorField::new('description'), 'saleStatus' => ToggleField::new('saleStatus')->setSortable(true), 'isEligibleTicketRestaurant' => ToggleField::new('isEligibleTicketRestaurant')->setSortable(true), ]; } }