Skip to content
Menu
Open World News Open World News
  • Privacy Policy
Open World News Open World News

Category: News

Specbee: Mastering Drupal 9 Layout Builder: A Comprehensive Guide to Effortlessly Customize Your Website’s Design

Posted on March 14, 2023 by Michael G
Mastering Drupal 9 Layout Builder: A Comprehensive Guide to Effortlessly Customize Your Website’s Design
Mustakim Farooqui
14 Mar, 2023

When it comes to page building, site builders, content authors, and content editors are constantly on the lookout for a smooth, user-friendly experience. When they wish to design and construct pages, they expect to use drag-and-drop and CKEditor technologies. This identical experience is provided by Drupal Layout Builder’s simple page construction functionality in the Drupal core. 

The distinctive Drupal Layout Builder offers a potent visual design tool to let content authors alter how content is presented. Layout Builder, which was added to Drupal core in its most recent version, Drupal 9 enables you to add/remove sections to show the content using various layouts and customize your pages according to what you need. With Drupal 9’s Layout Builder Module, you can mix these sections to make a completely unique page.

There are two different ways to use the Drupal 9 Layout Builder: Layout Defaults (to design a layout for all the content of the content type) and Layout Overrides (to design a layout for the specific content item). You may learn more about and get started using the Drupal 9 Layout Builder module with the help of this blog.

Watch out for our next article on this series where we dive into using the layout builder and Ctools module to apply view mode patterns!

Specbee: Mastering Drupal 9 Layout Builder: A Comprehensive Guide to Effortlessly Customize Your Website's Design

Introducing the Layout Builder

You can change how entities like content types, taxonomies, users, and more look by using the Drupal 9 Layout Builder module. Site builders may easily drag and drop blocks, fields, and other elements into place using this feature.

By providing a preview of the changes made as you design your layouts, the layout builder module in Drupal 9 facilitates the layout-building process. The layout builder in Drupal 9 enables previews of the changes made for a smooth layout creation experience rather than requiring users to save every tiny modification they make to the layout and then look it up on the front end.

The layout builder has two modules:

Layout Discovery – Gives modules or themes a means to register layouts.

Layout Builder – Enables users to directly add and organize blocks and content fields on the content.

When designing a layout, Layout Builder uses two key ideas:

Sections – Columns or containers where blocks can be placed. For example, it could be a 2-column layout or a 3-column layout, etc.

Blocks – Content elements that can be placed in sections.

Layout Builder module installation and configuration

Go to Extend and activate the Layout Builder and Layout Discovery modules to install and configure the Drupal 9 layout builder module.

add new module

Modify the Content Type and Taxonomy

Once the module has been installed, go to Structure, Content types, and select “Manage display” for any content type. For this example, we’ll use the “article” content type.

manage display

Click the Layout options drop-down menu at the bottom to select “Use Layout Builder,” then click Save.

layout options

 

Field formatters are replaced with a “Manage layout” option after Layout Builder is activated in the view mode. Each of the available view modes can be used with Layout Builder.

manage display

 

You will be taken to the article content type layout when you click “Manage layout.”

article content items

Insert Sections into the Layout

Remove the default section before adding any more ones to the layout builder. Select the “close” button (as depicted in the below screenshot). Also, a button to remove the default section will be available to you on the right side of your screen. Then select “Remove.”

configure section

 

By selecting the “Add Section” option, let’s add a few sections to our layout. On the right side of the screen, options will also be offered to you so that you can select a layout for your section. For now, let’s pick the “Two Column Section.”

two column

 

You will be given the option to select the “Two Column Layout” width. For now, let’s choose a “67%/33%”. Next, select “Add section.”

section configuration

 

After being added, each section region should display an “Add Block” link.

add block

Insert Blocks into the Section Regions

You can add blocks to your area after selecting it for the layout. Simply click “Add Block” and the “Choose a block” option will slide out from the right when you want to add a block.

choose block

Selecting a block

Just clicking on the blocks in the right column will choose them. Using the “Filter by block name” text field, you can even locate blocks by filtering out the search based on their names.
For now, we’ll choose the “Body” content field.

create custom block

 

The field formatter will allow you to make changes when you click on the block you want to add. Click “Add Block” after configuring the formatter.

add block details

 

On the left side of the block, there will be a “Body” content area.

body content

 

The “Body” field has been added; now save your changes. By selecting “Save Layout” from the menu at the top of the Drupal 9 layout page, you can save all the changes you’ve made to your section.

content preview

 

To further personalize our layout builder, let’s try adding a few more fields to our design.

field configuration

 

When you visit a page with article content type after saving this layout, you will be able to see a preview of the layout you just created.

Layout Overrides:

The layout we just created will work for all of the articles. Drupal has a number of settings that must be enabled in order to create a custom layout for a certain article. To do this, select “Allow each content item to have its layout customized”.

layout options

 

If you visit an article after activating this option, a Layout tab button will be visible.

layout button

 

With the same interface, the layout may now be changed. This, however, will only alter the design of this one piece of content.

Now let’s add a block to this page. Create a new one-column section and click the “Add Block” button. Consider the case when we wish to show recently edited content from other users on this page, Filter off the “Recent content” block when adding a new block, then customize it to your needs before saving the layout.

recent article

 

Eventually, when we’ve included the most recent article block, our page will appear like this.

recent article preview

 

Important: If you’ve changed the layout of a single entity, you won’t be able to disable the Layout Builder.

You can only update the layout options once you’ve reset all altered layouts to their original settings.

layout option

Layout Builder from Code

When it comes to GUI management, Drupal Layout Builder is undoubtedly amazing. The programming problems you deal with while using the tool on a regular basis, nevertheless, might be a little more difficult. Now, you might ask how to use Layout Builder using code. 

It turns out that it’s rather simple to enable and disable templates for a single entity.

Simply load the display using the following code:

$entityViewDisplay = Drupal::entityTypeManager-
>getStorage('entity_view_display')-
>load('ENTITY_TYPE.ENTITY_BUNDLE.VIEW_MODE');

It will then return an object of the type LayoutBuilderEntityViewDisplay, which you must then change as follows:

$entityViewDisplay->enableLayoutBuilder();

If you wish to additionally set the flag or activate the Layout Builder for a specific view mode:

$entityViewDisplay->setOverridable(TRUE);

to enable the creation of unique layouts for a single entity.

After that, you must save everything.

$entityViewDisplay->save();

What actually occurs in the background is that the Layout Builder module adds the layout_builder_key to the third_party_settings of a certain entity type, with values for the parameters described above (enabled, allow custom), and then stores the default layout for this type of entity under sections.

A new entity field named layout_builder__layout is created and used to hold the updated layout for this specific entity if the setOverridable option is set to TRUE.

Contrarily, it takes a little more work to create a section using code and populate it with relevant content.

Starting off, let’s add a new section. The layout_id parameter, which serves as a layout identifier, must be included when creating a new instance of the Drupallayout_builderSection class in order to accomplish this.

Protip: The layout discovery module contains the default templates. Layouts are defined in *.layouts.yml files. For more detailed information, please check out the following article on how to create custom layouts in drupal.

Then, adding a new element directly to the section would be the simplest course of action. To do this, use the appendComponent method, which accepts an instance of the Drupallayout_builderSectionComponent class as an argument. Nevertheless, before you can develop such a section component, you must first arrange a few things. To start, you will require:

  • the uuid of the embedded element,
  • the name of the region in the section,
  • plugin configuration.

In this tutorial, we’ll embed a sample node in a single-column section using the plugin supplied by Entity Blocks:

$section = new Section('layout_onecol');
$uuid = $node->uuid();
$region = 'content';
$pluginConfiguration = [
  'id' => 'entity_block:node',
  'provider' => 'entity_block',
  'label_display' => FALSE,
  'view_mode' => 'default',
  'entity' => $node->id(),
];
$component = new SectionComponent($uuid, $region, $pluginConfiguration);
$section->appendComponent($component);

Always keep in mind that layouts are saved in third-party settings or a field; therefore, in order to save the section, you must do so in one of these locations.

In our case, a field is being used, so:

$entity->layout_builder__layout->setValue($section);
$entity->save();

You have now added a single column section to an entity and shown an example node in it by following all of these steps.

You may also be interested in Improving Drupal’s Layout Builder Experience.

Layout Builder Pros and Cons

We’ve compiled a brief list of some advantages and disadvantages of Layout Builder below:

Pros:

  • Deployment is simple because there is no need to add new entity types because the module is already included in the core.
  • User-friendly UI with drag-and-drop capabilities.
  • Choices for individual entity customization.
  • A simple method for combining fields with other entities without the need to add more reference fields.
  • A simple method of leveraging entity blocks to embed existing entities.

Cons:

  • New entity types and embeddable elements add to the website’s size, which significantly lengthens the time it takes for all items to load.
  • The module is UI-focused, so creating new layouts might be simpler. Right now, we have to write code to generate.yml files and templates.
  • Dragging elements between sections can be a little challenging when there are many parts in the layout.
  • Twig’s names are suffixed with uuid, making it challenging to render a specified section and restricting access to sections.

Final Thoughts

The Drupal Layout Builder opens us to a wide range of intriguing possibilities for managing layouts through both user interface and code. Will it replace all current solutions?
It is the ideal tool, in my opinion, for dealing with the layout issue on a large scale. It seems like the best course of action would be to use widely used modules like Paragraphs and Field Group to create closed components, and then Layout Builder to create pre-made layouts composed of these components.

Layout Builder has a unique purpose, much like every other Drupal module. As a result, it will always perform better in some situations while performing substantially worse in others. Check it out for yourself!

If you’re looking for experts to help you out with anything Drupal, we’re just an email away!

Author: Mustakim Farooqui

Meet Mustakim Farooqui, Drupal Developer, and our own Chess master. He dreams of visiting Europe and enjoys reading novels and tech articles. When not working, you can find him with a game of chess, solving puzzles, or checking out new Linux distros. Give him a strong cup of coffee and he’ll set sail for anything!

Drupal 9
Drupal Module
Drupal 9 Module
Web Development
Drupal Development
Drupal Planet

 

Recent Blogs

Image
Drupal 9 layout builder teaser

Mastering Drupal 9 Layout Builder: A Comprehensive Guide to Effortlessly Customize Your Website’s Design

Image
fetch drupal reference entities teaser

How to Efficiently Fetch Drupal Reference Entities in Custom Modules

Image
santhosh

Finding Balance – Santhosh Kumar’s Parallel Worlds

Want to extract the maximum out of Drupal?
TALK TO US

Featured Case Studies

Itsoc logo

IEEE Itsoc

Upgrading the web presence of IEEE Information Theory Society, the most trusted voice for advanced technology

Explore

Semi 252x91-01.png

Semi

A Drupal powered multi-site, multi-lingual platform to enable a unified user experience at SEMI

Explore

gsh logo

Great Southern Homes

Great Southern Homes, one of the fastest growing home builders in the US, sees greater results with Drupal

Explore

View all Case Studies

From a Rails app print logs in the Chrome console

Posted on March 14, 2023 by Michael G
https://github.com/railsjazz/railsochrome how to print your log messages from the Rails app in the Chrome console.

Handle exceptions in Ansible Playbooks with block and rescue

Posted on March 14, 2023 by Michael G

Handle errors gracefully in your automation by using Ansible block and rescue keywords. Read More at Enable Sysadmin

The post Handle exceptions in Ansible Playbooks with block and rescue appeared first on Linux.com.

Daura e Tarjuma e Quran – Shuja Uddin Sheikh – 13th March 2023 – ARY Qtv

Posted on March 13, 2023 by Michael G
Daura e Tarjuma e Quran – Host: Shuja Uddin Sheikh

1st Time In Electronic Media’s History Complete Translation & Tafseer Of Quran Kareem.

#ShujaUddinSheikh #DauraeTarjumaeQuran #ARYQtv

Subscribe Here: https://bit.ly/3dh3Yj1

Official Facebook: https://www.facebook.com/ARYQTV/
Official Website: https://aryqtv.tv/
Watch ARY Qtv Live: http://live.aryqtv.tv/
Programs Schedule: https://aryqtv.tv/schedule/
Islamic Information: https://bit.ly/2MfIF4P
Android App: https://bit.ly/33wgto4

Food Exploration- Fried Rice Balls made with Chor-Chor-Os rice | Farm To Table

Posted on March 13, 2023 by Michael G
Aired (March 12, 2023): Chef JR Royol makes Fried Rice balls with Chor-Chor-Os rice and a cherry tomato-based sauce, once again using Chor-Chor-Os rice.

Open Donasi Ranca Upas Bikin Warganet Murka

Posted on March 13, 2023 by Michael G

VIVA – Panitia penyelenggara event trail Ranca Upas, Bandung membuat amarah warganet mendidih. Pasalnya, mereka seakan tidak memiliki niat untuk bertanggung jawab secara penuh. Justru melibatkan orang lain atas perbuatan buruk mereka. (RP-DRP-DA)

bangla chudachudi golpo// বাংলা চটি গল্প

Posted on March 13, 2023 by Michael G
MAGI CHODAR GOLPO,
amake chodar golpo
amar apu ke chudlam,
Apu Ke cHodar Golpo
apu ke chodar golpo bangla font,
apun boudi ke choda
apur kajer boro mai
aunty ke chodar bangla golpo
baba ke bea kerar golpo
baba meye chodar bangla golpo
baba meye chodar golpo
baba r meye chodar bangla golpo
babar samne ma ke chudlam
baine arshata chodachudi,
bangla choda chodir golpo
Bangla Choda chudir Golpo,
bangla chodar golpo
bangla chodon kahini
bangla choti
bangla choti 69
bangla choti baba meye
bangla choti club
Bangla Choti Daily Update
bangla choti family
bangla choti golpo
bangla choti golpo 2022
bangla choti golpo list
bangla choti golpo ma chele
bangla choti golpo site,
bangla choti kahini,
bangla choti kamdev
Bangla Choti Ma Chele,
bangla choti site,
bangla choti wordpress
bangla choti world,
bangla choty golpo
bangla choty kahini,
bangla chuda chudi golpo,
bangla chudachudir golpo,
bangla coti golpo,
bangla cuckold golpo,
bangla voda marar golpo
bangladeshi chuda chudi golpo
bangladeshi maa cheler chodar golpo
baro bon ke chodar golpo
baro bon ke gud marar golpo
bd choti golpo
bengali choti story
bengali panu story
best bangla choti
best choti golpo
bhabhi chodar golpo
bhabhi chodar Story
Bhabhi Gud
bhabhi k chodar bangla story
bhabhi k chodar golpo
bhabhi k chodar kahini
Bhabhi ke Chodar bangla Golpo
Bhabhi ke Chodar Golpo
Bhabhi ke Chodar khini
bhabhi ke chodar mojar golpo
Bhabhi ke gudmarar golpo
Bhabhi ke kes khabar golpo
BhaBhier Gud
Bhabhike Chodar golpo
Bhabhike Chodar Story
Bhabhike Chudai
Bhabhike Chudar Khahini
Bhabhir Boro Gud
Bhabi ke Choda Choti Golpo
bhagni ke chodar golpo
bhai bon chuda chudi golpo
bidhoba kajer bou ke choda
bidhoba ma ke chodar bangla golpo
bien near sathe choda chudir golpo
bon k chodar golpo
bon ke chodar kahini
bondhur bou chodar golpo
Bonke Chodar Golpo
boro bon ke chudlam
boro dudh ola kajer meyeke choda
boro dudh tepar golpo
boro dudher bhabhi
boro dudher jala
bou k chodar bangla golpo
boudi ke choda
boudi ke chodar golpo
boudi ke chodar golpo bangla
boudi ke chodar golpo with photo
boudi ke chodar moja
Boudi Ke Chuda
Boudiike Chodar Golpo
Boudike choda
Boudike Chodar Bangla Golpo
Boudike Chodar Golpo
Boudike Chodar Khini
Boudike Chodar Story
Boudike Chodar Suke
boudir baro pasa chodar golpo
boudir boro pasa chodar golpo
Boudir Doodh Chodar Golpo
boudir dudh er golpo
Boudir Gud
boudir gud chodar golpo
boudir guder mal
boudir guder rosh
boudir guder rosh khelam
boudir pachar golpo
boudir pachay mar don
boudir pod marar golpo 2010
boudir putki marar golpo
boudir rosalo voda
Boudir Sasti
Boudir Voda
bouma ke chodar golpo
chachato bhabhi k chodar golpo
chele ma ke chudte chai
choda chodi golpo
choda chuder golpo
Choda Chudir Chti
Choda Chudir Golp
Choda Chudir golpo
choti golpo baba meye,
Choto khalake Chodar Golpo,
choto magir dudh,
chuda chudir choti golpo,
chudachudi choti golpo,

Mike Herchel’s Blog: Creating Your First Single Directory Component within Drupal

Posted on March 13, 2023 by Michael G
Creating Your First Single Directory Component within Drupal

mherchel

Sun, 03/12/2023 – 20:00

Trending Ruby repositories

Posted on March 13, 2023 by Michael G
https://opensource-heroes.com/discover/ruby list of trending repositories

Theo de Raadt to be presenting at CanSecWest.

Posted on March 13, 2023 by Michael G
Dragos Ruiu recently announced that Theo de Raadt will be presenting at this year’s CanSecWest, March 22-24 2023 in Vancouver, BC.

Read more…

  • Previous
  • 1
  • …
  • 608
  • 609
  • 610
  • 611
  • 612
  • 613
  • 614
  • …
  • 821
  • Next

Recent Posts

  • Mentorship program to nurture pre-seed tech founders
  • Qwen3-Coder
  • Open Source is Back
  • An easy way to develop Home Assistant integrations
  • SmartEsq has launched an AI-powered MFN Election tool

Categories

  • Android
  • Linux
  • News
  • Open Source

Recent Posts

  • Mentorship program to nurture pre-seed tech founders
  • Qwen3-Coder
  • Open Source is Back
  • An easy way to develop Home Assistant integrations
  • SmartEsq has launched an AI-powered MFN Election tool

Categories

  • Android
  • Linux
  • News
  • Open Source
©2025 Open World News | Powered by Superb Themes
We use cookies on our website to give you the most relevant experience by remembering your preferences and repeat visits. By clicking “Accept All”, you consent to the use of ALL the cookies. However, you may visit "Cookie Settings" to provide a controlled consent.
Cookie SettingsAccept All
Manage consent

Privacy Overview

This website uses cookies to improve your experience while you navigate through the website. Out of these, the cookies that are categorized as necessary are stored on your browser as they are essential for the working of basic functionalities of the website. We also use third-party cookies that help us analyze and understand how you use this website. These cookies will be stored in your browser only with your consent. You also have the option to opt-out of these cookies. But opting out of some of these cookies may affect your browsing experience.
Necessary
Always Enabled
Necessary cookies are absolutely essential for the website to function properly. These cookies ensure basic functionalities and security features of the website, anonymously.
CookieDurationDescription
cookielawinfo-checkbox-analytics11 monthsThis cookie is set by GDPR Cookie Consent plugin. The cookie is used to store the user consent for the cookies in the category "Analytics".
cookielawinfo-checkbox-functional11 monthsThe cookie is set by GDPR cookie consent to record the user consent for the cookies in the category "Functional".
cookielawinfo-checkbox-necessary11 monthsThis cookie is set by GDPR Cookie Consent plugin. The cookies is used to store the user consent for the cookies in the category "Necessary".
cookielawinfo-checkbox-others11 monthsThis cookie is set by GDPR Cookie Consent plugin. The cookie is used to store the user consent for the cookies in the category "Other.
cookielawinfo-checkbox-performance11 monthsThis cookie is set by GDPR Cookie Consent plugin. The cookie is used to store the user consent for the cookies in the category "Performance".
viewed_cookie_policy11 monthsThe cookie is set by the GDPR Cookie Consent plugin and is used to store whether or not user has consented to the use of cookies. It does not store any personal data.
Functional
Functional cookies help to perform certain functionalities like sharing the content of the website on social media platforms, collect feedbacks, and other third-party features.
Performance
Performance cookies are used to understand and analyze the key performance indexes of the website which helps in delivering a better user experience for the visitors.
Analytics
Analytical cookies are used to understand how visitors interact with the website. These cookies help provide information on metrics the number of visitors, bounce rate, traffic source, etc.
Advertisement
Advertisement cookies are used to provide visitors with relevant ads and marketing campaigns. These cookies track visitors across websites and collect information to provide customized ads.
Others
Other uncategorized cookies are those that are being analyzed and have not been classified into a category as yet.
SAVE & ACCEPT