Empresas
Empregos
  • Sobre nós
  • Soluções
    • Publicação de vagas
      Publique sua vaga e receba candidatos qualificados em 48h.
    • Avaliações de candidatos
      Mais de 500 testes técnicos e psicológicos, mais anti-fraude.
    • Headhunting
      Busca executiva personalizada do início ao fim.
    • Folha de Pagamento + EOR
      Dispersão de folha e EOR em mais de 15 países da LATAM.
  • Preços
  • Empregos

0

190
Visualizações
How to overwrite a html-element but keep the rest of a block?

I am extending a twig-template where i want to replace the line

<div class="container">

with

<div class="container-fluid">

Twig-template

{% block layout_main_navigation %}
    <div class="main-navigation"
         id="mainNavigation"
         data-flyout-menu="true">
        {% block layout_main_navigation_navbar %}
            <div class="container"> <!-- This line should be replaced -->
                {% block layout_main_navigation_menu %}
                    ...
                {% endblock %}
            ...
        {% endblock %}
        ...
{% endblock %}

I tried to overwrite the layout_main_navigation by copying everything and changing the class of the div. But i am not happy with that solution as i have to copy and overwrite a lot blocks.

How can i achieve replacing the class of the div and overwrite as less block as possible?

over 4 years ago · Santiago Trujillo
1 Respostas
Responde à pergunta

0

You can override the block layout_main_navigation_navbar, add the div element with the desired class container-fluid and then include the original content of the block layout_main_navigation_menu using the parent() function:

{% block layout_main_navigation_navbar %}
    <div class="container-fluid">
        {% block layout_main_navigation_menu %}
            {{ parent() }}
        {% endblock %}
    </div>
{% endblock %}

over 4 years ago · Santiago Trujillo Relatório
Responde à pergunta
Encontrar trabalhos remotos

Descubra a nova forma de encontrar um emprego!

melhores empregos
Principais categorias de trabalho
Empresas
Postar vaga Preços Comercial
Jurídico
Termos e Condições Política de privacidade
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomende algumas ofertas para mim
Preciso de ajuda