官术网_书友最值得收藏!

  • Learning Drupal 8
  • Nick Abbott Richard Jones
  • 245字
  • 2021-07-16 09:36:53

Blocks

If you have a layout that contains sidebars, headers, or footers, you will most likely have content that is repeated between pages. If you edit this content in one place, you would expect it to be updated on every page.

This is where blocks come in.

In Drupal 8, there is another entity type called a block.

A block is a piece of content that can be placed in a specific region of a page, and you can set rules that determine when (on which actual pages) the block appears, depending on various conditions such as the page URL or the currently logged in user's role(s).

An example of a block is the Main menu.

A typical simple website page template will often have a header, footer, and perhaps, left and right sidebar regions as shown in the following diagram:

Within these page template regions, you can add repeating content such as the site logo, a menu, shopping cart, terms and conditions, or other items of content.

Because Drupal is a modular framework, modules can define a block that you can place on your site. For example, the Commerce module provides a "Shopping cart" block.

You can also create custom blocks, which are essentially individual blocks of hand-coded HTML.

The important point to remember here is that much of the content on your Drupal site appears one way or another, as a series of blocks and blocks are placed within regions on the page.

主站蜘蛛池模板: 黑山县| 巴彦淖尔市| 大宁县| 兴宁市| 丹江口市| 柘荣县| 湖州市| 武邑县| 收藏| 阿勒泰市| 连山| 增城市| 肇源县| 北碚区| 遂川县| 邹平县| 徐水县| 阳朔县| 美姑县| 和硕县| 沭阳县| 崇文区| 鹤峰县| 黔西县| 司法| 托克逊县| 宁津县| 安丘市| 溆浦县| 尼木县| 和田县| 习水县| 中江县| 桃江县| 邹城市| 柘城县| 伊金霍洛旗| 连城县| 德惠市| 怀来县| 甘孜县|