TOC not displaying set elements when placed via Layout Builder

Created on 16 September 2025, about 1 month ago

Problem/Motivation

Using CkEditor Embedded content or by placing the TOC block, one doesn't see the list of items, from the settings e.g. h2, h3.

Steps to reproduce

Drupal 11.2.4
PHP 8.3
Layout Builder

When one places the block, one gets:

Warning: Undefined array key "#id" in sector_toc_preprocess_block() (line 25 of /var/www/html/public/profiles/contrib/sector/modules/sector_toc/sector_toc.module)

Proposed resolution

Change:

$variables['elements']  to  $variables['elements']["#configuration"]["id"]

Remaining tasks

Check that TOC works with Embedded content, and by placing the block, and via Layout Builder.

🐛 Bug report
Status

Active

Version

1.0

Component

Code

Created by

🇳🇿New Zealand stewest Wellington

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

Comments & Activities

Not all content is available!

It's likely this issue predates Contrib.social: some issue and comment data are missing.

No activities found.

Production build 0.71.5 2024