In this video, you’ll be introduced to blocks and regions.
We cover the following:
- What are blocks
- What are regions
Before we jump into this course, let’s talk about what blocks and regions are. A block is a bit of HTML, which is added into a region. A block can be something as simple as a list of links, or it can be a fully built form. And if you want to write a bit of custom code, well, you could implement a block to do anything, really. Let’s take this homepage for example. The logo and site name is displayed using a site branding block. The navigation, which just has the home link, is also a block. This stuff in the sidebar, search and tools, those are both blocks. Then in the footer, we have the footer menu and the Powered by Drupal link, which are both blocks.
Then in regards to regions, a region is an area in the theme that a block can be placed into. And these regions are implemented by the theme. So every theme will have a different set of regions. The site branding block, which I mentioned earlier, this is in the header region. The main navigation is in the primary menu region. The blocks in the sidebar are in a region called Sidebar First, and the footer menu and Powered by Drupal are both in a footer region. Then we have the content region, which often has the page title and tabs. And most importantly, it also has the main page content block, which renders everything that is not a block. The names of the regions vary depending on the theme, but most come with a set of header footer and sidebar regions. So just to recap, a block is a bit of HTML, which is placed into a theme region and a region is an area in the theme where blocks can be added to.