Problem

I am unable to add block using Layout Builder.

Steps to reproduce

After Installing and enabling Layout Builder block module :
Step 1: Create a node
Step 2: Go to Layout of that Node
Step 3: Add Section
Step 4: Select 2 column layout or any other layout
Step 5: Click on "Add Block"
Step 6: Choose any block and observe the console of Browser

Proposed resolution

Remaining tasks

User interface changes

API changes

Data model changes

Comments

amol.palhade17 created an issue. See original summary.

alokbhatt’s picture

I am facing the same issue while adding the layout to a page.

alokbhatt’s picture

Assigned: amol.palhade17 » alokbhatt
mahmoud-zayed’s picture

Hi,

Please navigate to network tab at console and click add block again, it should show more details about the issue.

Thanks,
Mahmoud

alokbhatt’s picture

StatusFileSize
new764 bytes

Due to icon path in module file the popup is breaking. Not sure why base_path() is not working.

alokbhatt’s picture

Status: Active » Needs review
rajab natshah’s picture

Having the same issue with Drupal 9.
And when the site is located in a sub-directory.
And when the site is a multilingual website with a URL language selection.
much like
#3188729: Fix Error when choosing or editing a layout for a section

Suggesting to remove base_path or change it to the original path
\Drupal::request()->getSchemeAndHttpHost() . \Drupal::request()->getBaseUrl()

Removing the base_path is the better option in my opinion.

rajab natshah’s picture

Title: Unable to add block in layout and it gives ajax error » Fix Unable to add block in layout and it gives ajax error
rajab natshah’s picture

StatusFileSize
new758 bytes
rajab natshah’s picture

Assigned: alokbhatt » Unassigned
rajab natshah’s picture

Title: Fix Unable to add block in layout and it gives ajax error » Fix Unable to add a block in layout and it gives ajax error
aaronchristian’s picture

Awesome thanks for submitting the patch @RajabNatshah!

aritrika.d’s picture

Can someone guide me with the second step that is mentioned in the steps to reproduce section, Step 2: Go to Layout of that Node??
As there is no documentation of that module available I am unable to reproduce.
Thanks in advance

mahmoud-zayed’s picture

Hi @aritrika.d

When you enable the layout builder for a specific content type, it will show a layout tab when you view the node. if you click that tab you will be able to add sections and blocks.

The first 5 steps not related to the module these steps are common when you use the Drupal Core Layout builder module but the functionality of this module starts in the last steps. I would recommend searching on youtube with "Drupal Layout Builder", you will find many videos that showed how it works.

Regarding the documentation, it's a valid point, we will try to write it and of course, the community is welcome to contribute to it.

Thanks,
Mahmoud

mahmoud-zayed’s picture

Thanks, @alokbhatt & Rajab for the patches :)

mahmoud-zayed’s picture

Status: Needs review » Fixed
mahmoud-zayed’s picture

Status: Fixed » Closed (fixed)