CMSFolks

How to Use Drupal Blocks and Region

How to Use Drupal Blocks and Region

drupal blocks
Pin me to your Pinterest Boards

Blocks are container objects that are used to organize the content of your website. It can be displayed in the regions on your page. It can also be said to be boxes of content rendered into an area, or region, of a web page (such as “Who’s online”) that can be displayed in regions such as the footer on your web page. This functionality is provided by the Block module, which is a part of Drupal 8 core.

But you may be wondering what exactly is the Block and Region in terms of differences…

Blocks

If you start off with a blank template, you need to fill it with content. Each piece of content that you put on your page is referred to as a block. Blocks are assigned to regions. For example, you can assign a menu (block) to your sidebar (region), or you can assign a site search form (block) to your header (region). The image below gives a better understanding.

How to Use Drupal Blocks and Region

Regions

Regions in Drupal are predefined areas in your template where content can be added to. For example, the header, footer, and sidebar are all regions. The image below talks better

How to Use Drupal Blocks and Region

Now that you know what Blocks and Regions are including their differences, Let take a look at how we can view block and region is Drupal

How to view block regions in Drupal

When assigning a block to a region, you’ll need to know where various regions are defined in your Drupal theme. In this tutorial, we’ll show you how to view where the individual block regions are located in your theme.

Firstly, login to your Drupal as an administrator and then click Structure. Click Blocks and look to click the link towards the top that is similar to Demonstrate block regions (Bartik). You should see an image like the one below

How to Use Drupal Blocks and Region

Now that we know the position of blocks in Drupal, let’s create a new block.

How to create a new block in Drupal

To create a new block in Drupal, follow the methods below.

Click Blocks and then Click Add block

How to Use Drupal Blocks and Region

There are several fields that we need to fill out for this new block. We’ve outlined these values below.
How to Use Drupal Blocks and Region
Block title
Enter a title for your block. If you enable the option to show a title for your block, this is what will show.
Block description
The block description is used primarily to identify this particular block in your Drupal admin section. If you had 20 different blocks, for example, unique descriptions will help you organize and manage your blocks more efficiently.
Block body
The block body is the bulk of your block. For example, if you were creating a block to show social media icons, the HTML code would be entered in the Block body.
Text format
The Text format controls if and how your block body will be filtered. For example, there are some options that allow HTML code and others that don’t. If you select a different Text format from the drop-down menu, you will see the text below it change to highlight the details of the particular format that you selected.

Region Settings

How to Use Drupal Blocks and Region

The region settings allow you to setup where each of your blocks will appear. Beneath each listed theme, select the region to display the block in. In order to know how to choose a region, you’ll first need to know where each region is within your theme. Keep in mind too that you can change the region blocks are assigned to at any time.

Visibility settings

How to Use Drupal Blocks and Region

Pages
The Pages setting allows you to restrict which pages this block will be displayed in. For example, if you had a block that showed a Google map of where your business is located, you may only what that block to show on your Contact Us page.
Content types
The Content types setting allows you to control which content types this block will appear with.
Roles
The Roles setting allows you to specify which types of users can see this block. For example, if you only want logged in users to be able to see the block, you can specify that here.
Users
Drupal gives each user the ability to customize how your site will display for them, this includes the option to show or hide certain blocks. If you want users to be able to toggle on/off the display of this block, you’ll do that within the Users settings.

When you are through configuring your block, click the Save block button at the bottom of the page. You should now be able to visit your site and view your new block (depending on the Region Settings as described above).

Now that you have created a new block, you may want to change the region in which a block is assigned to, how do you do it?

Changing the region a block is assigned to in Drupal

Sometimes your needs change and you may want to assign that particular block to a new region. In this Drupal 7 tutorial, we’ll show you how you can move blocks to different regions.

Go to Structure and Click Blocks.

Here you can see all the different blocks currently available and where they are placed. If you want to change the location of a block of content, simply find the block and select the Region you want the block to display from the drop-down menu. You’ll need to know where each region is located within your template, so be sure to learn how to do this.

Once you are finished, select Save blocks.

That is all for now. Comment below and let’s know where you have difficulties

CMSFolks Editorial Crew

Editorial Staff at CMSFolks is a team of WordPress experts led by Ajayi Adekunle. Site maintained by CMSFolks Studio.

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.

Close Menu
×

Cart