Print debug stack trace (within block)

Trying to extend a formbuilder plugin for Pimcore (https://github.com/dachcom-digital/pimcore-formbuilder) I am trying to modify the output of input/select fields in order to be compatible with MD Bootstrap syntax.

Therefore I override /FormBuilderBundle/Form/Theme/bootstrap_4_layout.html.twig. The shortened content of this file is like this:

{% extends 'bootstrap_4_layout.html.twig' %}

{% use '@FormBuilder/Form/Theme/Type/dynamic_multi_file.html.twig' %}
{% use '@FormBuilder/Form/Theme/Type/html_tag.html.twig' %}
{% use '@FormBuilder/Form/Theme/Type/snippet.html.twig' %}
{% use '@FormBuilder/Form/Theme/Type/container.html.twig' %}

{% block form_row -%}
    {% set form_row_class = attr['data-template'] is defined ? attr['data-template'] : 'col-12' %}
    {% if form.vars.is_form_builder_container_block is defined %}
        {% set form_row_class = 'formbuilder-container-block' %}
    {% endif %}
    <div class="formbuilder-row md-form {{ form_row_class }}">
        {{ parent() }}
    </div>
{%- endblock form_row %}

The problem is that there is no other file called bootstrap_4_layout.html.twig (except in the macros folder) and the template can not extend itself. I want to find out what the parent() function is doing here in order to alter the output (https://twig.symfony.com/doc/3.x/functions/parent.html).

As I still did not find the template which is extended I would like to print the parent() functions’ stack trace in order to know which files are involved. Is there any possibility to do this with Twig (maybe with a Twig Extension)?

Source: Symfony Questions

Was this helpful?

0 / 0

Leave a Reply 0

Your email address will not be published. Required fields are marked *