I have a third-party package OriginalBundleand I want to customize some of its templates.
To do this, I installed the Symfony package MyCustomBundleusing the override method shown in the Symfony docs .
<?php
namespace My\CustomBundle;
use Symfony\Component\HttpKernel\Bundle\Bundle;
class MyCustomBundle extends Bundle
{
public function getParent()
{
return 'OriginalBundle';
}
}
Then I use MyCustomBundle to create versions of some Twig templates from the original package. However, I would like to be able to access the original template from my version (for example, extend it) and just overload some of the blocks.
But if I try to do something like this:
{
{% extends 'OriginalBundle:Foo:bar.html.twig' %}
{% block xyz %}
{
{% endblock %}
Then I get a white screen of death. I assume this causes some recursion as Symfony routes the call extendsback to the configured file?
:
{
{% block abc %}
{% block xyz %}
{
{% endblock %}
{% endblock %}
, ...
- , ?
Twig/template parent::doSomething().
, , .