4

I am using EasyAdmin 4.6 for a project and I have a CollectionField that display Needs entities nested to the Edit CRUD of another entity called JoinUs :

enter image description here

The thing is, my Collection field is displaying my entities but I can't find a way to change the accordion title (bottom of the picture above).

Here is my configureFields method in JoinUsCrudController.php :

    public function configureFields(string $pageName): iterable
    {
        yield TextField::new('name')->setLabel('Nom de la page');
        yield TextareaField::new('content')->setLabel('Contenu de la page')
                                    ->setFormType(CKEditorType::class)
                                    ->setFormTypeOptions(
                                        [
                                            'config_name' => 'custom_style',
                                            'attr' => ['rows' => '20', 'class' => 'w-100'] ,
                                        ])
                                    ->addCssClass('field-ck-editor');


        yield CollectionField::new('needs', 'Besoins')
            ->setEntryIsComplex(true)
            ->setEntryType(NeedsType::class)
            ->setColumns(12)
            ->allowAdd(true)
            ->allowDelete(true)
            ->setFormTypeOption('by_reference', false);
    }

Where can I change the accordion value displayed ?

I've read the documentation of EasyAdmin and it doesn't seem to be there

ledukilian
  • 71
  • 6

1 Answers1

0

You need to create the __toString(){} method of the Need entity

<?php 
// ...

class Need {

// ...

    public function __toString() {
        return $this->name;
    }

}

// ...

Aries
  • 744
  • 5
  • 13