Added blocks to allow standard layout titles to be overridden #1209

wants to merge 1 commit into


None yet

3 participants

fazy commented Mar 6, 2013

I was trying to integrate some pages that use Sonata with pages that don't; I want the Sonata heading bar on my non-Sonata pages too. This mostly worked but I also wanted to be able to set the page title without copying and pasting the whole template.

To allow this, I have added {% block head_title %} and {% block page_title %}.

(I didn't use 'title' because that's probably already used by people in their template hierarchy). Let me know if I should do this differently. :)

fazy commented Mar 6, 2013

Actually, since doing this pull request, I've discovered that if I create a {% block title %} on a template that extends Sonata's standard_layout.html.twig, it seems to get picked up anyway (after clearing cache of course). I can't see why or how this is happening though.

sstok commented Mar 10, 2013

The title renders _title variable which is basically the rendering of the title block.

{% set _title = block('title') %}
@rande rande closed this Mar 27, 2013
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment