Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

205
Views
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 answers
Answer question

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 Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!