Reynier
Reynier

Reputation: 2478

Change Sonata Admin Logo based on database record

I have a module for manage images inside my Sonata Admin. I want to display those images where sonata logo is placed, how I can do that? I have the code for get the images in my controller and also the template to display the image but don't know how to use this from Sonata, any advice?

Upvotes: 0

Views: 1384

Answers (1)

nixoschu
nixoschu

Reputation: 544

You can override the sonate base template (like you overide any other template) or any block listed inside of it.

there is a block called logo and it looks like this

{% block logo %}
  <a href="{{ url('sonata_admin_dashboard') }}" class="brand">
    <img src="{{ asset(admin_pool.titlelogo) }}"  alt="{{ admin_pool.title }}" />
    {{ admin_pool.title }}
  </a>
{% endblock %}

In combination with a Twig-Extension it should be no problem to fetch the image out of the database

Upvotes: 2

Related Questions