Pregunta

My question is simple but I don't think that the answer is. I'll try to be clear as possible.

I have the Sonata Admin Bundle, that allows me edit or view tables, etc. It's ok.

I also have a custom bundle (where my main app is). The interface of this bundle has been created with twig calling javascript. Basically, the interface is composed by three parts :
• a header with buttons
• a "center region" that is changed dynamically, depends on which buttons you click on
• a footer in the bottom, that display standard informations like mail, website, etc.

My bundle is accessible through url/app_dev.php/homescreen
The Sonata admin interface is accessible through url/app_dev.php/admin/dashboard

Now, what I would like to do, is to be able to "charge" the admin interface powered by Sonata inside the center region of my bundle. But as you don't manage the routing in Sonata because he is generated automatically, how could I make it works ?

The best would be to only display a part of the Sonata Admin Interface (for example, a grid list of table without the Sonata's header, etc).

If anyone knows some tips about it, it would be gladly appreciated ! I hope I'm clear as possible.

If needed I can provide codes/further informations.

Thanks.

¿Fue útil?

Solución 2

I finally found myself the answer.

The best way is to do an AJAX request from ExtJS that call a Sonata's URL.
Be careful with all the html contents of the Sonata's twig, because it can cause issues when displaying in your app's pages (example : you are requesting html codes that contains header when your page has already one).

Otros consejos

You can edit the routing to reach your admin interface at the homescreen url :

admin:
    resource: '@SonataAdminBundle/Resources/config/routing/sonata_admin.xml'
    prefix: /homescreen

_sonata_admin:
    resource: .
    type: sonata_admin
    prefix: /homescreen

sonata_user:
    resource: '@SonataUserBundle/Resources/config/routing/admin_security.xml'
    prefix: /homescreen

And for more tuning, you can use the generateUrl($name, $options) method. More details about that in the documentation.

Licenciado bajo: CC-BY-SA con atribución
No afiliado a StackOverflow
scroll top