2

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 ?

Pierrick Rambaud
  • 1,726
  • 1
  • 20
  • 47

2 Answers2

2

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

Pierrick Rambaud
  • 1,726
  • 1
  • 20
  • 47
0

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.

Dylan KAS
  • 4,840
  • 2
  • 15
  • 33
  • if you add an empty string to the `label`, easyadmin use the humanized version. My objective is to avoid template overriding for something as simple as `label: false` – Pierrick Rambaud Dec 09 '19 at 10:05
  • Maybe adding a css class to the property you want to hide the label and use a global javascript function to hide every label concerned ? – Dylan KAS Dec 09 '19 at 10:31
  • You can just `label: ' '` (add whitespace) – Flash Dec 12 '19 at 16:45