Eric B.
Eric B.

Reputation: 24411

How to remove the "delete" action in Symfony 1.4 edit admin page?

I'm trying to remove the "Delete" action from an admin generated edit page. I realize that I can create my own template and remove the action from there, but I figured that there must be a way to remove it using the generator.yml file.

My generator.yml file is:

generator:
  class: sfDoctrineGenerator
  param:
    model_class:           Poem
    theme:                 admin
    non_verbose_templates: true
    with_show:             false
    singular:              ~
    plural:                ~
    route_prefix:          poem
    with_doctrine_route:   true
    actions_base_class:    sfActions

    config:
      actions: ~
      fields: ~
      list: ~
      form:    ~
      filter: ~

      edit:    
        actions: {}

      new:     ~

And yet, the edit page still shows the "Delete", "Back to list" and "Save" actions at the bottom of the page.

How can I control which actions are displayed?

Upvotes: 1

Views: 2975

Answers (2)

Sebastián Rojas
Sebastián Rojas

Reputation: 2891

Try this (in order ti keep the list link and save button, but not the delete link in the edit view, and to remove delete link y list view):

config:
  actions: ~
  fields:  ~
  list:
    object_actions: {_edit: ~}
  filter:  ~
  form:    ~
  edit:
    actions:
      _list: ~
      save: ~
  new:     ~

Upvotes: 2

Mike Purcell
Mike Purcell

Reputation: 19989

Try this:

edit:
  actions:
    _edit: ~

Add any other actions you may have, just leave off the delete action. I have a highly customized generator.yml file, but didn't remove the delete link, so I tried the code and it appeared to work as requested.

Upvotes: 2

Related Questions