Cài đặt Block improvements trong Drupal 8 rất dễ

Cài đặt Block improvements trong Drupal 8 rất dễ

Graph Query Language do Facebook tạo ra từ năm 2012

Average: 9.5 (13 votes)

Làm thế nào để tương tác với hệ sinh thái của React JS hiệu quả

Average: 9.4 (13 votes)

Cài đặt Block improvements trong Drupal 8 rất dễ

Blocks in Drupal 7 are pretty useful but, in practice, larger sites often have requirements that core blocks can't support like placing the same block in different regions for different content types. I’m happy to see core blocks have been improved in Drupal 8 to be much more practical and powerful.

I was fortunate to attend the Drupal North conference this month in Montreal. At Drupal North, Ted Bowman gave a nice presentation on the power of Drupal 8 blocks. Ted has also has created a helpful Drupal 8 contrib module called Block Visibility Groups that extends blocks even further.

In his talk, he explained some of the new abilities of blocks including:

  • Blocks can be exported
  • Blocks can be placed in different regions
  • Blocks can have fields

Let’s take a look at these new features and the Block Visibility Groups module in more depth.

Blocks can be exported

First, blocks are now exportable. In Drupal 7, block settings can be moved through the development workflow with Features, but it isn't always reliable. In Drupal 8, block settings are saved in core configuration files and these files can be checked into your favorite code repository such as git.

Example of a block configuration file in D8

D8 Block Configuration Export

Blocks can be placed in different regions

Another improvement in Drupal 8 is that a particular block can be in more than one theme region. For example, if a site needs to have the same block on two different pages in two different regions that is not possible with core blocks in Drupal 7. Site builders have to use other methods, such as using Panels or Context to achieve this.

Now, in Drupal 8, placing the same block in different regions for different pages (or even on the same page!) is possible. Let’s see how that looks.

Example of the "Help" block being placed in two regions

Drupal D8 Block Multiple Regions

Blocks can have fields

Another important difference for Drupal 8 core blocks is that they can have fields. In Drupal 7, we have to use the Bean (Blocks Entities Aren't Nodes) module to have fields on our blocks.

In D8, you can add fields to blocks in the same way you add them to content types or other fieldable entities. This feature changes block versatility immensely! We can have block types of various flavors and use those in intelligent ways. For example, we could have a block type that has just links in it or one with a text blurb and an image. Using block types is much better for structured content (which is the basis of a solid content strategy).

Example of a custom block type with a custom field

Example of D8 Custom Block Type

Blocks are even better with contrib

The block system has improved with the help of D8 contributed modules as well. An excellent example of this is Ted Bowman’s Block Visibility Groups module. With this small module enabled, administrators can manage where all blocks are visible. This admin tool is a valuable UX improvement and an alternative to Panels for less complex sites in Drupal 8.

D8 Block Visibility Group

Have fun with your Drupal 8 blocks!

Bạn thấy bài viết này như thế nào?: 
No votes yet




Dich vu khu trung tphcm

Dich vu diet chuot tphcm

Dich vu diet con trung

Quảng Cáo Bài Viết

Vô hiệu hoá bất kỳ hiệu ứng trực quan trong window 7
Vô hiệu hoá bất kỳ hiệu ứng trực quan trong window 7

Nếu bạn đang tìm kiếm một cách nâng cao tốc độ và hiệu suất, xin vui lòng làm theo những hướng dẫn này để có được Windows 7 với tốc độ cực nhanh! Hướng dẫn này thực sự có thể giúp bạn có được hiệu suất và tốc độ như là bạn mong muốn.

Dropbox tích hợp chức năng chia sẻ file theo nhóm trên Facebook

Người dùng Facebook trước giờ luôn có nhu cầu chia sẻ những dữ liệu nào đó với bạn bè của mình. Chức năng chia sẻ file cho những người trong cùng Group là một lựa chọn quen thuộc.

Cách bật Disqus module trong Drupal 7
Cách bật Disqus module trong Drupal 7

First, Disqus is free to use and works on virtually any type of website. You can easily import all your existing comments