Undefined array key "class" in template_preprocess_toc_tree() in toc_api.module

Created on 26 February 2025, 16 days ago

Problem/Motivation

When using the toc_api module in Drupal, an undefined array key "class" error is encountered in the function template_preprocess_toc_tree(). This error occurs at line 123 of modules/contrib/toc_api/toc_api.module.

Steps to reproduce

Enable the toc_api module.
Use it in conjunction with a content type or view where the table of contents (TOC) is displayed.
Navigate to a page where the TOC is rendered.

Proposed resolution

Adjust the template_preprocess_toc_tree() function in toc_api.module to check if the "class" key exists before accessing it. This ensures that the error is prevented when the key is not defined.

🐛 Bug report
Status

Active

Version

1.7

Component

Code

Created by

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