0
votes

i generated doctrine-admin in backend. In frontend i have form for add new news. I must unset field is_confirm, that ordinary user can't add news at once for home site. This working good, but if i generated admin module with doctrine then if i will add in backend new News then i dont have field is_confirm. If i delete unser in NewsForm.class.php then this working.

If i add this in config:

config:
  actions: ~
  fields:  ~
  list:    ~
  filter:  ~
  form:    ~
  edit:    ~
  new:     
    display: [is_confirm]

its doesnt help.

How can i thix fix?

1

1 Answers

0
votes

You should inherit from NewsForm creating a new form (unsetting the fields you like) to be used in the frontend. This way you let the original form with the most fields for use by the admin app.

If you need to tell the admin generator which form to use, you should modify the generator.yml like the following

config:
  actions: ~
  fields:  ~
  list:    ~
  filter:  ~
  form:    
    class: NewsFrontendForm
  edit:    ~
  new:     
    display: [is_confirm]