Search code examples
symfonysonata-adminsymfony-2.3

Hide "Add new" for just one module


I'll like to know if it's possible to hide the "Add new" link in some modules, for example I have this:

Module 1 ----- Add  ------ List
Module 2 ----- Add  ------ List
Module 3 ----- Add  ------ List
Module 4 ----- Add  ------ List

But I want this:

Module 1 -----      ------ List
Module 2 ----- Add  ------ List
Module 3 ----- Add  ------ List
Module 4 -----      ------ List

How I can get this done?


Solution

  • Try this, May be helpful.

        $formMapper
                ->add('Module1', null,array())
                ->add('Module2', 'sonata_type_model',array())
                ->add('Module3', 'sonata_type_model',array())
                ->add('Module4', null,array())
    

    In add method set null second arguments to hide "add new" button