Skip to content

Commit 3327f6b

Browse files
smulvihillsylus
authored andcommitted
Issue #3258089 by smulvih2: Table of Contents (TOC) template issue
1 parent 3f31593 commit 3327f6b

File tree

2 files changed

+60
-52
lines changed

2 files changed

+60
-52
lines changed

templates/toc/toc-tree.html.twig

Lines changed: 0 additions & 52 deletions
Original file line numberDiff line numberDiff line change
@@ -50,55 +50,3 @@
5050
</ul>
5151

5252
{% endmacro %}
53-
{#
54-
/**
55-
* @file
56-
* Default theme implementation to display a Table of contents as a tree.
57-
*
58-
* Returns HTML for a nested list representation of a Table of contents..
59-
*
60-
* Available variables:
61-
* - tree: A nested list of header items. Each header item contains:
62-
* - list_tag: HTML tag for the list.
63-
* - list_attributes: HTML attributes for the list.
64-
* - attributes: HTML attributes for the table of contents or list item.
65-
* - below: The table of contents child items.
66-
* - title: The table of contents or header title.
67-
* - url: The header fragrment (ie hash) URL, instance of \Drupal\Core\Url.
68-
*
69-
* @ingroup themeable
70-
*/
71-
#}
72-
{#
73-
We call a macro which calls itself to render the full tree.
74-
@see http://twig.sensiolabs.org/doc/tags/macro.html
75-
#}
76-
{% import _self as toc_api_tree %}
77-
78-
<div class="toc-inner">
79-
80-
{% if tree.title and not options.block %}
81-
<h2>{{ tree.title }}</h2>
82-
{% endif %}
83-
84-
{{ toc_api_tree.tree_links(tree) }}
85-
86-
</div>
87-
88-
{% macro tree_links(item) %}
89-
{% import _self as toc_api_tree %}
90-
91-
<ul>
92-
93-
{% for child_item in item.below %}
94-
<li>
95-
{{ link(child_item.html, child_item.url) }}
96-
{% if child_item.below %}
97-
{{ toc_api_tree.tree_links(child_item) }}
98-
{% endif %}
99-
</li>
100-
{% endfor %}
101-
102-
</ul>
103-
104-
{% endmacro %}
Lines changed: 60 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,60 @@
1+
diff --git a/templates/toc/toc-tree.html.twig b/templates/toc/toc-tree.html.twig
2+
index 1a015e8..c6fde5f 100644
3+
--- a/templates/toc/toc-tree.html.twig
4+
+++ b/templates/toc/toc-tree.html.twig
5+
@@ -50,55 +50,3 @@
6+
</ul>
7+
8+
{% endmacro %}
9+
-{#
10+
-/**
11+
- * @file
12+
- * Default theme implementation to display a Table of contents as a tree.
13+
- *
14+
- * Returns HTML for a nested list representation of a Table of contents..
15+
- *
16+
- * Available variables:
17+
- * - tree: A nested list of header items. Each header item contains:
18+
- * - list_tag: HTML tag for the list.
19+
- * - list_attributes: HTML attributes for the list.
20+
- * - attributes: HTML attributes for the table of contents or list item.
21+
- * - below: The table of contents child items.
22+
- * - title: The table of contents or header title.
23+
- * - url: The header fragrment (ie hash) URL, instance of \Drupal\Core\Url.
24+
- *
25+
- * @ingroup themeable
26+
- */
27+
-#}
28+
-{#
29+
- We call a macro which calls itself to render the full tree.
30+
- @see http://twig.sensiolabs.org/doc/tags/macro.html
31+
-#}
32+
-{% import _self as toc_api_tree %}
33+
-
34+
-<div class="toc-inner">
35+
-
36+
- {% if tree.title and not options.block %}
37+
- <h2>{{ tree.title }}</h2>
38+
- {% endif %}
39+
-
40+
- {{ toc_api_tree.tree_links(tree) }}
41+
-
42+
-</div>
43+
-
44+
-{% macro tree_links(item) %}
45+
- {% import _self as toc_api_tree %}
46+
-
47+
- <ul>
48+
-
49+
- {% for child_item in item.below %}
50+
- <li>
51+
- {{ link(child_item.html, child_item.url) }}
52+
- {% if child_item.below %}
53+
- {{ toc_api_tree.tree_links(child_item) }}
54+
- {% endif %}
55+
- </li>
56+
- {% endfor %}
57+
-
58+
- </ul>
59+
-
60+
-{% endmacro %}

0 commit comments

Comments
 (0)