Search code examples
sonata-adminsymfony-sonata

SonataAdminBundle show view with tabs


I'm using SontaAdminBundle and I want to organise my show action on tabs.

protected function configureShowFields(ShowMapper $showMapper)
{
    $showMapper
        ->tab('Infos personnelles')
            ->with('Beneficiary', array('class' => 'col-lg-6'))
                ->add('email')
                ->add('firstname')
                ->add('lastname')
                ->add('civility')
                ->add('dateOfBirth')
                ->add('enabled')
                ->add('address')
            ->end()
        ->end()
        ->tab('projects')
            ->with('projects')
                ->add('title')
                ->add('statusLabel')
            ->end()
        ->end();
}

But It doesn't work. Is there another config to do.

Thx


Solution

  • The config you used is good, you just need to update your version of sonata to master, check the changes in this commit:

    https://github.com/sonata-project/SonataAdminBundle/commit/fd1a1596f86bfb4afdafe9767efaa4c787bba6a5

    where the SonataAdminBundle/Resources/views/CRUD/base_show.html.twig was updated.

    Hope this helps.