Populate data to drupalSettings to enable Dynamic Code Components

Created on 20 June 2025, 4 days ago

Overview

To enable dynamic usage of Code Components, we need to expose specific pieces of data to the Code components via `drupalSettings`. This includes information that is usually rendered by blocks like system branding or breadcrumb blocks, but will now be needed directly in Code components.

Proposed resolution

Populate the following values in `drupalSettings` under a new top-level key `xbData` (note: not under xb, which is reserved for internal Experience Builder needs):

- `drupalSettings.xbData.system_branding_block` with contents similar to:

  {
    "homeUrl": "/",
    "logo": "/core/misc/logo/drupal-logo.svg",
    "siteName": "My awesome website",
    "siteSlogan": "<p>This website is the best. It's better than all the rest.</p>"
  }

Other fields/data that needs to be populated are:
- Site logo
- Page title
- Site name
- Breadcrumb
- (data shape) system_branding_block.json
- (data shape) system_breadcrumb_block.json
- base_url

📌 Task
Status

Active

Version

0.0

Component

Code

Created by

🇪🇸Spain isholgueras

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

Merge Requests

Comments & Activities

Production build 0.71.5 2024