Place block URL generation error

Created on 27 February 2024, 4 months ago
Updated 26 April 2024, 2 months ago

Problem/Motivation

We are using a multisite setup for Drupal. Our URLS are "www.example.com/site1/homepage"
Currently the URL generation in blocks.js is:

  let ajaxConfig = {
    url: '/lb-plus/place-block/' + drupalSettings['LB+'].sectionStorageType + '/' + drupalSettings['LB+'].sectionStorage,
    type: 'POST',

It should use the Drupal URL function to generate proper URLS:

  let ajaxConfig = {
    url: Drupal.url('/lb-plus/place-block/' + drupalSettings['LB+'].sectionStorageType + '/' + drupalSettings['LB+'].sectionStorage),
    type: 'POST',

Steps to reproduce

Have a multisite approach with urls like: www.example.com/site1/homepage.
When you then want to place a block, via drag & drop, JS will throw an error on the path: www.example.com/homepage"
> note withouth "/site1"

Proposed resolution

Use the Drupal.URL function

Remaining tasks

Review, I will provide MR.

πŸ› Bug report
Status

Needs work

Version

2.1

Component

Code

Created by

πŸ‡§πŸ‡ͺBelgium Mschudders

Live updates comments and jobs are added and updated live.
Sign in to follow issues

Merge Requests

Comments & Activities

Production build 0.69.0 2024