Edit on GitHub
Jump to docs navigation

Twig Components / Methods / parent

parent is a Twig function to render the contents of the parent block when overriding a block by using the parent function, when a template uses inheritance.

{% extends "base.html" %}

    {% block sidebar %}
    <h3>Table Of Contents</h3>
    ...
    {{ parent() }}
{% endblock %}

The parent() call will return the content of the sidebar block as defined in the base.html template.

See alsoΒΆ

extends , block , block

Source: Twig



Edit this page on GitHub
Couldn't find what you were looking for? We are happy to help you in the forum, on Slack or on Github.