In this video, you’ll learn how to manage blocks.
We’ll cover the following:
- Learn how to access the block layout page
- Use demonstrate block regions page
- How to configure blocks
- Ordering blocks
- Disabling and removing blocks
In the previous video, I gave you an overview of the blocks and regions. Now let’s learn how to manage blocks. Make sure you are logged in as an admin user and then go to structure, then block layout. From this page, you can view all of the regions as well as the blocks in the regions. And here in the header region, you can see the site branding block. Then if we scroll a bit down, we can see the main navigation in the primary menu region. Then if we scroll further down, we can see the main content region, the sidebar regions, and then below that, we can see the footer regions. But it’s hard to visualise exactly where these regions are on the site, looking at just this page. But if we scroll all the way to the top and click on demonstrate block regions, we can see where the regions are on the front-end.
You can see exactly where the header, primary menu regions are, where the sidebar regions are, and then you can see where all of the footer regions are. If you have just installed a brand new theme and you don’t know exactly where the region is on the front-end, use this demonstrate block regions page to know exactly where it is. Now, to jump out of this page, just click on exit block region demonstration. And now let’s go ahead and place a block into the sidebar first region. Let’s scroll down to sidebar first, and that should be right under content. Then click on place block. And from this place block pop-up, you can see all of the available blocks which can be placed into regions, and you can also filter by name. So if we search for powered by Drupal, we can see the powered by Drupal block right here. Then to add it to a region, just click on place block.
From the configure block pop-up, we can change the pre-populated title. Then below title, using the display title check box, we can have the above title displayed on the front-end. Let’s leave it unchecked for now. Then below that we have the visibility settings, which we’ll cover in another video. Then below visibility, we have the region drop-down. Make sure that is set to sidebar first. Once everything has been configured, click on save block. And here you can see the powered by Drupal block which we just added to the region. Blocks can also be reordered within regions. All you need to do is click on the toggle and then move them up or down. Let’s move the block to the top, then scroll all the way down and click on save blocks. Now let’s go to the homepage and here we can see the powered by Drupal block in the sidebar. If you need to edit any of these blocks, you could go back to the block layout page. Or if you hover over the block, you should see this pencil icon with a link to the configure block page.
And while we are here, let’s check the display title check box, which will display the title on the front-end. Then if we click on save block, it’ll take us back to the previous page, and now we can see the powered by Drupal title on the block. As I mentioned earlier, you can go back to the block layout page. Scroll down to the block, then to edit the block, just click on the configure button. And this will take you back to the configure block page. Now, the final thing we’ll look at in this video is how to disable or remove a block. If you click on the down arrow next to configure, you’ll see two options, disable and remove. Let’s click on disable. Then if we scroll back down to sidebar first region, we can still see the block, but it has been disabled. Disabling a block simply hides it in the region. This is handy for when you want to temporarily hide a block because you want to test something out, because then to enable it, all you need to do is click on enable.
Then if we scroll back down, we can see that the block is now enabled. If we click on remove, this will remove the block from the region. If we scroll back down to sidebar first, you can see the block is no longer there. It hasn’t deleted the block. We could always add the block back in if we like, but it’ll simply remove it from the region. So let me go ahead and add the powered by Drupal block back in. And you can see now it has been added back in. So just remember, disabling a block simply hides it in the region, but removing a block will remove it from the region, but you can easily add it back in.