Reynier
Reynier

Reputation: 2478

Complete name instead of database record value

I have a database column that stores ENUM values, in this case I have a or i which means active or inactive. How, in admin-generator module, can I display Active / Inactive instead of a / i? Any help?

Edit: Display the Active or Inactive in index What I have now is as follow:

ID    Name   Active   Actions
1     Val1   a        Edit | Delete  
2     Val2   a        Edit | Delete
3     Val3   i        Edit | Delete

What I want to achieve is this:

ID    Name   Active   Actions
1     Val1   Active   Edit | Delete  
2     Val2   Active   Edit | Delete
3     Val3   Inactive Edit | Delete

Or just write a image_tag() depending on values something like checked.png when value is a or unchecked.png when value is i.

Upvotes: 0

Views: 58

Answers (1)

sinhix
sinhix

Reputation: 863

Where and what you want to change is very vague, but here goes :

In index page, just use a partial to override the displayed value via generator.yml. See symfony doc

Otherwise, in form pages, create another form, edit the sfWidgetFormChoice to have the wanted label. Then update the form class used in the module also via generator.yml. See symfony doc

Upvotes: 2

Related Questions