Bootstrap currently has code to hide the help region if it's empty, in Preprocess\Region.php:

    if ($region === 'help' && !empty($variables['content'])) {

If $variables['content'] contains placeholders, this test will think it's not empty. But then the placeholders may later be substituted by the empty string, and we end up with an empty help region.

To reproduce:
* Place the system messages block (which uses placeholders) in the help region:

* View any page that doesn't show anything else in the help region, and that prints no system messages:

I'm not sure how to fix this. Can we force the resolution of any placeholders?

Comments

vasi created an issue. See original summary.

markhalliwell’s picture

This is actually a core issue that has to be solved first before we can really do anything. Postponing on this related issue.

kaido.toomingas’s picture

What about {% if page.someregionname|render %}? This could fix or create some new problems. For me at this moment it seems to work.
Found this potential solution from https://www.drupal.org/node/953034

 {% if page.someregionname|render %}
 show me some content
{% endif %}
vasi’s picture

@kaido24, I think that would essentially disable BigPipe?

kaido.toomingas’s picture

Mhh tested Bigpipe on and created extra block with views using contextual filter to brake it. Didn't notice any strange behaviour.
I use current beta of bootstrap theme with a subtheme.

kevinwal’s picture

I had to do this: {% set firstsidebar_rendered = render_var(page.sidebar_first) %}
{% set secondsidebar_rendered = render_var(page.sidebar_second) %}

to change it all on rendering. Works for now even if it's not optimal. We can't have a left nav on about 120 sites when you don't need it.

dkosbob’s picture

StatusFileSize
new819 bytes

After looking through https://www.drupal.org/node/953034, it seems there really is no good way to prevent the status messages block from rendering in time, as it uses a placeholder.

Is there any harm in simply stripping out the icon and classes that get added to the help region during preprocess? This doesn't solve the core issue by any means, but it prevents something visually displaying when there isn't anything to actually display. I think this would make it simpler for a themer to disregard the region if there is nothing inside the wrapper.

Another option is to just not put the status messages block in the help region, but that's a pretty logical place for it and it takes a while to figure out whats going on when it is there. Removing the visual flourish could help curb some confusion for folks.

dkosbob’s picture

Status: Postponed » Needs review
markhalliwell’s picture

Category: Bug report » Support request
Status: Needs review » Closed (works as designed)

Is there any harm in simply stripping out the icon and classes that get added to the help region during preprocess?

No there's no real harm, but I won't do it in the base theme. Please feel free to extend the base theme's @BootstrapPreprocess plugin in your sub-theme and remove the relevant code.

Another option is to just not put the status messages block in the help region, but that's a pretty logical place for it and it takes a while to figure out whats going on when it is there.

Actually, from a semantic standpoint, placing "status" messages in a "help" region isn't very logical. This region was designed to show "help" related information (via the system help block, that modules populate)... hence the added icon/class.

Typically, placing status messages above the "Main Content" block in the "Content" region is quite sufficient. Also, new regions can be created in your sub-theme, above the content or elsewhere, if needed.

---

I'm actually going to mark this as "Closed (works as designed)" since there really should be only one block in this region: the system help block or nothing at all.

As far as the bigger core issue goes, that's not something we can tackle in this project and we'll just have to wait.