Pierrick Rambaud
Pierrick Rambaud

Reputation: 2364

how to remove property label in new and edit actions?

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 ?

Upvotes: 2

Views: 1804

Answers (2)

Pierrick Rambaud
Pierrick Rambaud

Reputation: 2364

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

Upvotes: 2

Dylan KAS
Dylan KAS

Reputation: 5663

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.

Upvotes: 0

Related Questions