Search code examples
phpsymfonysonata-admin

How to change the "sonata project" link in SonataAdmin?


I have a problem with SonataAdminBundle, I don't find how to change the "sonata project" link in the left board.

I have "My title" + one image and under there is "sonata project".

How can I change this ?


Solution

  • In order to customize the content of the block under Sonata Admin (by default it's a link with text sonata project), you have to modify your app/config/config.yml file by adding this:

    sonata_admin:
        # ...
        templates:
            # Override default template
            layout: AcmeAdminBundle::standard_layout.html.twig
    

    Then create the standard_layout.html.twig file in the src/Acme/AdminBundle/Resources/views directory:

    {# src/Acme/AdminBundle/Resources/views/standard_layout.html.twig #}
    {% extends 'SonataAdminBundle::standard_layout.html.twig' %}
    
    {% block side_bar_after_nav %}
        <p class="text-center"><a href="{{ path('your_route') }}">Route name</a></p>
    {% endblock %}
    

    This will replace the default content of this block.


    If you don't want to place the file in a bundle, use this path in app/config/config.yml : layout: "::standard_layout.html.twig" ant put the file in app/Resources/views.


    And if you want to change the title Sonata Admin, add this to your app/config/config.yml file:

    sonata_admin:
        # ...
        title: My Name