Search code examples
symfony1doctrineadmin-generator

how to remove the "new" link in doctrine admin generator


Im using the doctrine admin generator, and I want to not allow the user to create new records (just to show them), is there any way to do that by setting up the "generator.yml" ? I've succeeded to remove de batch and per items actions and everything else is working perfect, but can't remove the "new" link =( This is what I have (the relevant part btw):

generator:
  params:
    config:
      list:
        batch_actions: {}
        object_actions:
          _delete: ~

Solution

  • You need to change the "actions" value of list:

    generator:
      params:
        config:
          list:
            actions: { }
    

    You could restrict to a credential via:

    generator:
      params:
        config:
          list:
            actions: { credentials: admin }
    

    To clarify the difference between the action types:

    • batch_actions - actions that can be performed on multiple items via the checkboxes and select widget at the bottom (e.g. bulk delete)
    • object_actions - actions that are performed on a specific item (e.g. edit)
    • actions - actions that appear in the list controls (e.g. new)