How to create a new block in Drupal 7

Now that we know the idea behind blocks in Drupal 7, we can create a new block. In the following tutorial we’ll show you how to create a new block in Drupal 7. We’ll also review the various settings that each block can be configured with.

To create a new block in Drupal 7:

  1. Log into Drupal 7 as an administrator
  2. In the top menu, click Structure
  3. Click Blocks
  4. Click Add block
  5. There are several fields that we need to fill out for this new block. We’ve outlined these values below.

    Initial Block Settings

    Block titleEnter a title for your block. If you enable the option to show a title for your block, this is what will show.
    Block descriptionThe block description is used primarily to identify this particular block in your Drupal 7 admin section. If you had 20 different blocks for example, unique descriptions will help you organize and manage your blocks more efficiently.
    Block bodyThe 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 formatThe 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.

    Creating our BlockHow it will appear on our site
    creating-a-new-block

    how-the-block-displays-on-our-site

    Region Settings

    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

    PagesThe 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 in your Contact Us page.
    Content typesThe Content types setting allows you to control which content types this block will appear with.
    RolesThe 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.
    UsersDrupal 7 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.
  6. When you are finished 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).

Was this article helpful? Join the conversation!

Server Madness Sale
Score Big with Savings up to 99% Off

X