EasyAdminBundle icon indicating copy to clipboard operation
EasyAdminBundle copied to clipboard

Dashboard title tag not set using content_title block

Open peamak opened this issue 1 year ago • 1 comments

I'm making a custom Dashboard, meaning in App\Controller\Admin\DashboardController I have:

#[Route('/admin', name: 'app_admin')] public function index(): Response { return $this->render('admin/dashboard.html.twig'); }

And in my template dashboard.html.twig, I have this:

{% extends '@EasyAdmin/page/content.html.twig' %}

{% block content_title %}My Awesome Title{% endblock %}

{% block main %} My Awesome Dashboard {% endblock %}

But the window title isn't being set. There is some BC stuff going on with title blocks, i.e. we're not supposed to use the block "page_title" but "content_title" and the base layout.html.twig does this:

{% set page_title_block_output %}{% block page_title %}{{ block('content_title') }}{% endblock %}{% endset %}

{{ page_title_block_output|striptags|raw }}

But it doesn't work for me… I need to explicitly set the block "page_title", as well as "content_title", like so:

{% extends '@EasyAdmin/page/content.html.twig' %}

{% block page_title %}My Awesome Title{% endblock %}

{% block content_title %}My Awesome Title{% endblock %}

{% block main %} My Awesome Dashboard {% endblock %}

Which is fine, just to be clear, but I think it's a bug… or I did something wrong which is entirely possible…

peamak avatar May 27 '24 11:05 peamak

i handled it the same way:

{% block page_title %}My Awesome Title{% endblock %}
{% block content_title %}My Awesome Title{% endblock %}

pfpro avatar May 27 '24 11:05 pfpro