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.
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?
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 ...
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 ...
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
6answers
6k views

Region for Main page content block field is required Error? [closed]

I have created a custom region called latest. And when I am assigning some block to that region from admin, while saving it returns this error Region for Main page content block field is required. ...
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"&...
6
votes
3answers
2k views

Block template suggestions

Is there a way to use a custom template for each block by title? For example, if I named my block "test1", and it is in the region "left1", I want to use the following template suggestions: block-...
6
votes
2answers
4k views

Moving Exposed Views Filter into another region of the page

Is there any way to move the exposed filters of views into another region of the site? i.e. I want to have a Search functionality attached to the a view by exposing the "Search: Search Terms", but I ...
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.
5
votes
3answers
2k views

Programmatically create a block region in Drupal 7

I am stuck with programmatically creating of regions in Drupal 7. I know how to create regions in .info file, but my problem is that I want regions for every node I create, to show a specific block to ...
4
votes
3answers
6k views

How is the height defined for a region in a Drupal theme?

I can see that regions are defined in the .info file for a theme but I can't see how these regions relate to CSS that would be used to style them. For example, in the acq_minimal / Minimal theme, the ...
4
votes
1answer
3k views

How to make a specific region use a specific template?

I'm currently working on Drupal 7 project in a Zen sub-theme. Each of my region uses "region.tpl.php" as HTML/PHP template. I just created a new region called "foo". This region needs a different HTML/...
4
votes
1answer
2k views

how to check messages exists

I want to check is there any messages in my template in drupal 7 there was a global variable in page template variables messages now in drupal 8 I want to check is there any message but messages ...
4
votes
1answer
3k views

Blocks not visible when I log out

In Administration -> Structure -> Blocks I have defined Search box region with search box block and Left sidebar region with navigation block. These blocks are visible when I'm logged in but ...
4
votes
4answers
3k views

Hide region when block menu is empty

I got the 2nd level main menu in a block in the sidebar, drupal 8 correctly hides the menu (and the block) when the user browses a page that is not in this menu, but the theme continues to show the ...
4
votes
1answer
2k views

How to print a region in views.tpl.php?

I have a views-view-unformatted--viewsname--attachment.tpl.php. I want to print region in this file. I added function mytheme_preprocess_views_view(&$vars) { if ($blocks = ...
4
votes
3answers
5k views

Adding a class to a region

I am working on my theme in Drupal 8 and I want to add a class to my header div. I tried adding this to the region.vars.php file. if ($region === 'header') { $variables[header]['class'][] = '...
4
votes
1answer
984 views

add three triptych side by side

i have made a custom theme "Custom_stark" and made changes into .info file and added the triptychs regions[triptych_first] = Triptych first regions[triptych_middle] = Triptych middle regions[...
4
votes
1answer
2k views

How do I add an additional sidebar to a Zen sub-theme?

I want to add an additional sidebar to my zen based theme with fixed columns. I added it to the theme info, and printed it in the page.tpl.php file, but I don't know how to configure its CSS files to ...
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 ?
3
votes
3answers
4k views

Regions. how can I disable a region? (not disabling blocks)

I want to disable a region, to not show blocks in this region to an specific page. I want this because, I have several blocks (more than 20) so in this case is necessary enter to each block, and ...
3
votes
1answer
5k views

“Demonstrate Block Regions” not showing

I did a minimal install, with a desire to get rid of some of the stuff my site-to-be won't need. The problem I have... is I can't seem to get Demonstrate Block Regions working. It shows up on a "...
3
votes
3answers
2k views

How do I unset a region in template.php AND have it alter the body classes

In some cases I need to programmatically remove the sidebar_first region in template.php. So, I'm doing something like: function template_preprocess_page(&$variables) { if(my_condition){ ...
3
votes
2answers
511 views

Advantages of using context for sitewide blocks?

As far as loading time is concerned I haven't seen anywhere, including the documentation, if there is a real advantage in using the context module to display sitewide blocks over the Drupal default ...
3
votes
2answers
2k views

Alter a form in a block only if it is in a certain region

In my template.php I'm trying to alter a form in a views exposed block, but I only want to do this if that block is in a certain region in my theme. I'm using Drupal 7. Is that possible? What php ...
3
votes
2answers
1k views

Re-creating complex CSS footer layout in Drupal

I've been given some HTML & CSS files by our university web designer and need to replicate essentially the same layout into the library website I'm creating in Drupal. The footer (pleased see ...
3
votes
2answers
140 views

Unset regions for specific content type

I want to create a special content type that doesn't include the logo and main navigation. I have a helper module and have added the following section before renenabling it but it doesn't seem to be ...
3
votes
1answer
662 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 ...
3
votes
4answers
1k views

Add a Region for Slideshow in Zen

I want to create a region for a slideshow using the Zen Theme. The problem is, I don't know where to place the code in the page.tpl.php file. I want the navigation to be ontop, followed by the ...
3
votes
2answers
2k views

Get current region name in node template Drupal 7

I need to find out what region the node block is appearing in within the node template. I am using node block module to display nodes as blocks but need to know what region the node blocks are ...
3
votes
1answer
2k views

Enabling blocks in an install profile

I'm creating an install profile and I just can't seem to get my blocks enabled. When I check the database after using the code below in my install function it puts the records in the block table, ...
3
votes
2answers
816 views

How to avoid no-wrapper tags on regions?

How do I make sure ALL regions are wrapped according region.tpl.php? In a subtheme of Zen I have created my own regions and modified the page.tpl.php file to something like the following: <div #...
3
votes
1answer
877 views

block-[region].tpl.php is not working?

I just created the Blocks and Regions in drupal 6. Now I want to align these regions (by using DIV id's etc..), so I created a block-[region].tpl.php file and write HTML and PHP scripts. Unfortunately ...
3
votes
1answer
2k views

How can I place content in page_top in D7 since it is hidden in regions?

I need to place a small menu in the page_top region using D7. I know the region is hidden, so my thought is to create a completely new region in the place that page_top would be showing up (I'm not ...
3
votes
3answers
921 views

Insert block above comments in node

How to display block in node above comments. What i have tried is: create region - regions[above_comments] = Above comments after in template.php i have added this to THEME_preprocess_node $...
2
votes
3answers
2k views

make the sidebars and the “content” region the same length as each-other?

I have a website that has regions that are uneven. the sidebar first is a different length than the content, and the content is a different length that sidebar second. it looks something like this: I ...
2
votes
2answers
1k views

Render a region e.g page.sidebar_first in views-view.html.twig

Is it possible to render a region e.g sidebar_first in a views twig-file views-view.html.twig?
2
votes
3answers
1k views

Change region/block content based on current node

I am trying to figure out how to change the content of a region/block depending on the node being viewed. Lets say I was creating a website for a grocery store. The home page will have several links ...
2
votes
1answer
4k views

Commerce Kickstart demo: How do I change the region for the blocks Main Menu and Secondary Menu?

In the Commerce Kickstart demo the blocks Main Menu and Secondary Menu are assigned to the Menu region. You can see in the image: But I go to /admin/structure/block these blocks are Disabled. I mean ...
2
votes
3answers
6k views

How can I change the css classes on a menu's ul when it is placed in a particular region?

Drupal 7: I am struggling to figure out a way to change the menu structure that is printed when I place a menu block in a particular region. What I want to do is change the classes on the ul when the ...
2
votes
4answers
9k views

MODULE_preprocess_block() get rendered region in drupal 8

So I am trying to port a Drupal 7 module to Drupal 8, and am struggling with how to translate a "NAME_preprocess_block" method. In the D7 code, it filters by the region a block is getting rendered ...
2
votes
1answer
867 views

render() and theme() fields

I would like to assign some content from a node, lets say the body field, into a region. so I cannot theme this content in my node.tpl.php In the template_process_page(&$vars) i can easily set $...
2
votes
3answers
1k views

Moving content fields to different theme regions with display suite

I am trying to output node fields in different theme regions, particularly a node reference field into my theme's right sidebar region. I have read this is possible with display suite and display ...
2
votes
2answers
142 views

Can a block span more than one region in a theme?

Can a block span more than one region in a theme? Sometimes I would like content to do this, depending on the page. I'm aware (and heavily use) Panels which are great but I thought it would be worth ...
2
votes
2answers
169 views

Configuring Drupal 6.20 to display a different icon in a specific region on a specific group of pages

I've added a block called 'Course Information', configured the block to display on a particular group of pages (courses/full-time/*). This works fine, but I don't know to configure Drupal to display a ...
2
votes
2answers
946 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
1answer
907 views

Region for the footer not working, but the header is working

I have the following regions set up in my *.info.yml file: name: Test type: theme description: 'Theme' base theme: stable core: 8.x regions: header: 'Header' content: 'Content' footer: 'Footer' ...

1
2 3 4 5