how to remove property label in new and edit actions?

1.6k Views Asked by At

I use the easyadmin bundle in my symfony app for backend management.

I'd like to remove the label from some fields in the edit and the new view. I tried to use the same behaviour as in formbuilder :

form:
    fields:
        - {property: toto, label: false }

but the label is still displayed. Anyone knows the syntax to remove it ?

2

There are 2 best solutions below

0
Pierrick Rambaud On BEST ANSWER

Some are still arguing on github to know if it has to be considered as a bug or not. Anyways a solution already exists.

Fixes

To remove the label in easyAdim-bundle, you need to do as for the formbuilder of Symfony where you can remove the label with options. To modify the formbuilder in easy-admin you use the type_options option. It goes the same for the label :

form:
    fields:
        - {property: toto, type_options: {label: false} }

will display a form_row with an empty label, without css, without Js and without empty labels

3
Dylan KAS On

By default the label use the "humanized" version of the property name.

In your case it would be Toto and the property ageOfToto would be Age of toto.

You cannot disable the label by setting it to false (you can for an action but not for a field), however you can set an empty string instead.

form:
    fields:
        - {property: toto, label: '' }

You could also override the template to not have a label see overriding easyadmin templates.