Skip to content
● Meet Grav Guard: keep every Grav site you run secure and up to date, all from one place. Free for up to 3 sites. Read more →

Hide navigation from Form template

Solved by pamtbaau View solution

Started by John Martyn 3 years ago · 3 replies · 783 views
3 years ago

Hello everyone,

I'm trying to remove the navigation from the partials/form template in an inherited theme from Quark.

Probably not a complex problem, but I'm at a loss here!

3 years ago Solution

@PurpleRoom, You can't remove the navigation from the form template, because the navigation is part of the partials/base.html.twig template.,, ;-)

What you can do in base.html.twig, is surrounding the section that generates the navigation with something like:

TWIG
{% if page.template != 'form' %}
...
{% endif %}
👍 1
1 reply
last edited 11/27/23 by pamtbaau
3 years ago

Assuming you are using the form plugin's default template, I would copy that into your inherited theme's templates directory. This inherits from partials/base.html.twig. Then simply override the header_navigation block with nothing:

TWIG
{% extends 'partials/base.html.twig' %}

{% block content %}

    {{ content|raw }}
    {% include "forms/form.html.twig" %}

{% endblock %}

{% block header_navigation %}{% endblock %}

If that duplication of the content block bothers you (it does me), there are ways to inherit the form template from the plugin rather than overriding it, but the sensible thing to do is live with it :)

👍 1

Suggested topics

Topic Participants Replies Views Activity
Support · by TomW, 2 weeks ago
8 225 8 hours ago
Support · by alex, 2 months ago
8 666 23 hours ago
Support · by Supple, 5 days ago
1 97 1 day ago
Support · by TomW, 1 week ago
3 158 3 days ago
Support · by TomW, 6 days ago
2 105 5 days ago