Active
Project:
AdaptiveTheme
Version:
8.x-4.1
Component:
Theme Settings
Priority:
Normal
Category:
Support request
Assigned:
Unassigned
Reporter:
Created:
28 Oct 2022 at 17:22 UTC
Updated:
2 Jan 2023 at 20:13 UTC
Jump to comment: Most recent
Comments
Comment #1
mudd commentedEDIT: I've learned a lot since I started this thread, so clarifying the issue.
Problem/Motivation
I need to be able add a custom region and then not render it. AT uses a page-layout.markup.yml (I'm not sure if this is Flex Builder... I don't have any /site-builder/ directory under layout, so not sure), and seems to require that I define a new region INSIDE an existing or new "row" -- which I guess causes it to be rendered in page html. I would like to define the region, but not render it.
This AT/Flex-Builder will pass along "region_hidden" as a key to theme.info.html, but then the region is hidden from Blocks UI, where i need to use it.
Please jump down to #9 & #10 below -- my other comments are now irrelevant.
Comment #2
mudd commentedComment #3
mudd commentedComment #4
mudd commentedComment #5
mudd commentedComment #6
mudd commentedOk, so I found the file my_theme/layout/page-layout/page-layout.markup.yml, and added:
Now, I go into appearance settings, and Save layout settings, and then region "hidden" magically appears in my_theme.info.yml file, and shows up in structure/block. Yay!
So I can now go ahead and use it?
Comment #7
mudd commentedComment #8
mudd commentedIs AT treating the file, theme/layout/page-layout/page-layout.markup.yml, BOTH to define regions AND a template? Please let me know if there's a way to prevent render BUT not hide it from the Blocks UI (I mention 'regions_hidden' below)
Comment #9
mudd commentedI found this page -- https://www.lowfidelity.at/blog/adding-block-regions-drupal-8-using-adap...
This describes the exact situation: "Following the default approach of adding the region in the YOURTHEME.info.yml and page.html.twig, you'll quickly realize, that your changes are overwritten, when fiddling with your theme's settings..."
But my sub-theme doesn't have a /site-builder/ directory under layout. There's also no trace of "site-builder" anywhere under my sub-theme or in at_core. What now?
Changing this to a bug since there is historical reference to what seems should be a simple/supported task.
Comment #10
mudd commentedI think this issue perhaps lies both with TB Mega Menu and with AdaptiveTheme. I don't believe either is "at fault", rather they are simply a bit incompatible. (from what I know so far)
TB Mega Menu, in order to place blocks on their menu, the blocks must first be "placed" into any region. They claim this is necessary [something like the blocks need to be present in a particular table(??)]. Thus, a "hidden" region is prescribed. The old pre-Symfony way is to define a region in theme.info (now in .yml) and then leave it out of the page template (old .php, new .twig). This still works when using twig templates.
AdaptiveTheme however uses twig system [Flex Builder?] which isn't the simple model of having a full set of twig template files for all pages, form, views, etc. I don't fully understand the AT/Flex_Builder model so I'm not able to figure out how to pass some sort of instruction to omit a particular row or region from it's html output. AT/FB uses a "row" key in page-layout.markup.yml, and I can only figure out how to create a custom region when defining it inside a row.
It seems the Symfony way to hide a region is "regions_hidden", ala (confusing because my custom region ID is named "hidden"):
AT seems to properly pass this along to theme.info.yml. But it WONT pass along a simple region def:
So although I can define a region inside a row, and then hide it:
...this correctly prevents the region from being rendered in page html, but it also hides the region from the Blocks UI, thus tripping up TB Mega Menu. So I wish TBMM didn't require blocks to be pre-placed and all this hidden region business.
I noticed that AT has a "hide" checkbox in the layout rows suggestions, but all this does is add a CSS rule to display:none. So I'm just doing this to the entire row in my theme css, which is easier than using all those checkboxes:
This work around will do for now, but I'd really like to find a way to create a region and hide it by telling the template engine to not render it, without using regions_hidden.
Comment #11
mudd commentedShould I switch 4.1 to 5.x or Dev? (this module installs as /themes/contrib/adaptivethemes/, right?)
Comment #12
mudd commentedI finally found that I could prevent rendering of the region using theme_preprocess_html in mytheme.theme (however theme_preprocess_page was the method most of the recipes I found indicated. This post suggested using theme_preprcess_html):