Questions tagged [regions]

In a Drupal theme, the places where blocks can be put are called regions.

Filter by
Sorted by
Tagged with
58
votes
6answers
87k views

How do I create custom regions in a theme?

I want to add a new area which will be site wide. Describe the process of getting this new region into my theme, if possible generalize it for adding any new, custom region.
16
votes
1answer
5k views

How to make a theme hook suggestion for blocks according to region?

Since Drupal 8 it is not possible with template naming conventions to load a specific block template according to the region it is placed in ("Per-region block markup and per-region block templating ...
25
votes
1answer
14k views

Can regions be printed within a node template?

Can regions be printed within a node template, or are regions strictly confined to page templates?
10
votes
2answers
8k views

Printing regions in html.tpl.php

I need to output some regions in the html.tpl.php template since these don't change between page.tpl.php and page-front.tpl.php (just to name two). Basically I want to avoid code duplication. However ...
9
votes
2answers
2k views

How to assign blocks to particular regions on theme install?

Drupal 8 provides some blocks by default. Eg. Site Branding, Main Navigation, Powered by Drupal, Search etc. I have created a theme that has Site branding & Main Navigation named regions in which ...
7
votes
2answers
7k views

Place block region in node template

I am trying to place a block region inside a news content type but it is not rendering. node--news.html.twig: <article{{ attributes }} class="portal-article"> <h1 class="article-title"&...
11
votes
6answers
8k views

Splitting up content fields into different regions

My situation is as follows: I have a content type Seminar, with fields A, B, and C. I have regions Header, Footer, Content, and Sidebar Left. There are some fields in Seminar I want displayed in the ...
0
votes
2answers
142 views

How to redirect a newly registered user to a custom URL after signing up?

By default after a new user signs up, a redirect to the home page happens. But in such case I want to redirect such user to another page like node/35. In this node/35 I then want to display some ...
5
votes
1answer
3k views

What is the relationship between regions and panels?

From here, it is clear that regions contain blocks, but when working with Panels, are regions still relevant? If yes how? What is the relationship between regions and panels? Thanks.
3
votes
1answer
2k views

Determine which region a menu block is rendered in

I need to re-use the same menu in two different regions, with slightly different markup. My thought was to simply check which region the block was being rendered in, and use if statements to modify ...
3
votes
3answers
1k views

How do i get the all the regions available in the current theme programatically?

I want the list of the names of all regions available in the current theme in drupal 8. How to do this ? And is it possible to get the list of the blocks placed on that region ?
1
vote
1answer
190 views

Setting a variable as a class (using set classes) in a region template

I am attempting to set a common class if any preface region in my theme appears. I am trying to render this with a variable using set classes = [] in the region template in my theme. So far I have ...
2
votes
2answers
939 views

Add image field or other fields from node to a custom Block in Drupal 8

I am new to Drupal and I am learning pretty fast. However I am stuck on an issue. I need to make a custom Block for my content (node) images. There is a system-made content block which pulls from ...
2
votes
2answers
749 views

How to make a theme hook suggestion for menu according to region?

I'm placing the same menu block in two different regions whereas different html markup for the list is needed. So analog to my previous question "How to make a theme hook suggestion for blocks ...
0
votes
1answer
360 views

How to make a region available to a non-page tpl file?

I'm working with a custom theme (which I did not develop.) We're wanting to add a block to a specific node type, which has a template called node-session.tpl.php. This template prints out all kinds of ...
3
votes
1answer
660 views

How do I display two blocks separately?

In my header region, I have two blocks: menu and search. I want to add some other HTML between them. I tried using {{ content.menu}}, but it doesn't actually do return anything. I can split up the ...
2
votes
3answers
628 views

Hide a region with empty view in it

I have a region page_intro where I display a view, with some CSS on it. When the view is empty (return no result), the region is still displayed (All html code before and after {{ page.page_intro }}). ...
2
votes
2answers
407 views

Trying to make a custom region disappear upon user login, then reappear when user logs out

I've looked everywhere for an answer to my problem, but can't find one. My goal is to collapse/force a custom region on my website to disappear when a user logs in, and then have it reappear when the ...
1
vote
0answers
104 views

Need to display Views block in between two fields of a node [closed]

I have dynamic view block that i need to display between "body" and "last updated" fields of a Basic page node. (i.e. "last updated" field has to be at the bottom of a page).
1
vote
2answers
1k views

Insert region into html.html.twig

Is there any way to add a region into html.html.twig? I want to have one inside tag to be able to render different js counters through Block Layout
1
vote
1answer
78 views

How to move the user account/Profile 2 information from the content region to a sidebar region

On the "My Account" page i.e. /user, the account and Profile 2 information is by default residing in the content region. I would like to move everything to the right sidebar region. Any suggestions on ...
1
vote
0answers
59 views

What happened to my new Block Region?

I've added a "header" block-region to the theme I am using (I am using the Visia Theme) and I've done this like so: In my visia.info file: regions[header] = Header and in my page.tpl.php file: <...
0
votes
1answer
2k views

Render a custom region inside node template [duplicate]

I am attempting to render a menu assigned to a block right next to the body of a custom content type. I am using Drupal 7. I have a custom region defined within my template .info file. I would like ...
0
votes
1answer
55 views

How do I place a block in a region, programatically?

Why isn't my custom block rendering in the region I want? It shows in the content region, not my custom content_right region. function bootstrap_preprocess_html(&$variables) { if (\Drupal::...