Topic

Blocks

A block is a reusable widget that is placed inside regions (layout containers) of your theme. Blocks can be created, removed, rearranged, and configured in the Block layout administration page. Examples of blocks include the "Who's online" listing, the main navigation menu, and the breadcrumb trail. The main page content is also a block. Each block has its own configuration settings, which allow you to select which pages of your site will display the block.

A module can provide a block using the Plugin API. When a module provides a block, it is listed on the Block layout administrative page and can be placed in a region by a site administrator. Many tools, like Views or menus, have the ability to generate new blocks based on configuration, which can then be placed into regions.

Example tasks

  • Rearrange blocks in a theme by placing them in specific regions
  • Customize the visibility of a block for certain pages or types of pages
  • Provide a block in a module using the Plugin API

Confidence

The Block layout system underwent many changes and transformations during Drupal 8's development cycle. Be sure to scrutinize or avoid resources that were published before Drupal 8's official release (November 2015), as they can confusingly refer to configuration screens that have since been redesigned.

Drupalize.Me resources

We are still filling out our Drupal 8 library and this page will be updated with new tutorials as they are created.

  • What's New in Drupal 8: Blocks
    • Learn about what's changed with blocks between Drupal 7 and 8.
  • Working with Blocks in Drupal 7
    • Learn how to use blocks and how they effect layout on your site.
  • What Are Plugins?
    • Blocks are created using the Plugin API. Any module developer wishing to implement a new block will need to understand how the Plugin API works.
  • Layouts topic
    • Blocks are a key component of how page layouts in Drupal are designed and administered.

More Guides

We have guides on many Drupal skills and topics.

Explore guides

External resources