Bricks_after_header is displayed without a rendered header

Browser: Chrome Version 135.0.7049.85

I have a template of type Section and display it with bricks_after_header (10) after the header.

The problem: If I activate the maintenance mode and do not render the header, the section is still displayed. I think the section should only be rendered if the header is also rendered.

Hi @stabilo,

currently, there is no toggle, to also disable hooks like bricks_after_header when in the maintenance mode.

As this is not a bug, but the way how it works, I moved the topic to the Feature requests, to gather more feedback on that.

As a workaround, you can use the following function (don’t forget to allow it):

function is_maintenance_mode() {
	// Check if the site is in maintenance mode
	return \Bricks\Maintenance::get_mode() === 'maintenance';
}

and {echo:is_maintenance_mode} for a condition on your top/root element in your “above header” section template.

Best reagrds,
Matej

Hello,
thanks for the quick response.
Ok, what is a bug and what is not, I leave to you.

However, it does seem like a bug. “bricks_after_header” sounds like it should appear after the header.

If there is no header and it still appears, it seems like a bug.

Hi @stabilo,

in Bricks, we are rendering in the following order:

...
...
...
Before header
Header
After header
...
...
...

When you say render header (or not), you only affect the “Header” part, not the others. Because in your case, yes, not rendering that part is desired, but maybe there are users that would like to use that hook, to still render something, even if the header is not rendered, so it can’t be automatically disabled.

The workaround should work, though, right?

Best regards,
Matej

Okay, I understand. That makes sense.
I will test the workaround. But I think that should work.

Thank you very much!

1 Like