EasyAdmin 3 create custom field

3.2k views Asked by At

I'd like to create custom autocomplete field with externe api call. I'm using doc Create custom fields

But my template is not used.

public static function new(string $propertyName, ?string $label = null): self
{
    return (new self())
        ->setProperty($propertyName)
        ->setLabel($label)
        // this template is used in 'index' and 'detail' pages
        ->setTemplatePath('admin/field/address.html.twig')
        // this is used in 'edit' and 'new' pages to edit the field contents
        // you can use your own form types too
        ->setFormType(TextType::class)
        ->addCssClass('field-address')
        // these methods allow to define the web assets loaded when the
        // field is displayed in any CRUD page (index/detail/edit/new)
        ->addCssFiles('js/admin/field-address.css')
        ->addJsFiles('js/admin/field-address.js')
        ;
}

I've no error. I create template in : /templates/admin/field

Anyone has an idea ?

0

There are 0 answers