From fbc98cdd00f07196d5584cf89e80618bebd206d1 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Sven=20Sch=C3=BCring?=
 <46997-sunlix@users.noreply.drupalcode.org>
Date: Thu, 6 Mar 2025 08:33:25 +0000
Subject: [PATCH] Add $options['number_path'] as AND condition to display
 numbers in headings

---
 toc_api.module | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/toc_api.module b/toc_api.module
index 62aa9c3..4f72f57 100755
--- a/toc_api.module
+++ b/toc_api.module
@@ -73,7 +73,7 @@ function template_preprocess_toc_header(&$variables) {
   $options = $toc->getOptions();
   $variables['options'] = $options;
   $variables['header_options'] = $options['headers'][$item['tag']];
-  $variables['header_options']['display_number'] = in_array($variables['header_options']['number_type'], ['decimal', 'lower-alpha', 'upper-alpha', 'lower-roman', 'upper-roman']);
+  $variables['header_options']['display_number'] = $options['number_path'] && in_array($variables['header_options']['number_type'], ['decimal', 'lower-alpha', 'upper-alpha', 'lower-roman', 'upper-roman']);
 
   $variables['attributes']['id'] = $variables['id'];
   $variables['attributes'] = new Attribute($variables['attributes']);
-- 
GitLab