Skip to content

Commit e13506e

Browse files
committed
Check if tabs has child tabs
1 parent c97dbc6 commit e13506e

File tree

2 files changed

+8
-3
lines changed

2 files changed

+8
-3
lines changed

classes/header.php

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -109,6 +109,7 @@ public function export_for_template(\renderer_base $output) {
109109
$format->hastopictabs = count($tabslist) > 0;
110110

111111
$courseindex = '';
112+
$hassubtabs = false;
112113
if ($course->tabsview == \format_onetopic::TABSVIEW_COURSEINDEX) {
113114
$renderer = $format->get_renderer($PAGE);
114115
$courseindex = $renderer->render_from_template('core_courseformat/local/courseindex/drawer', []);
@@ -117,6 +118,7 @@ public function export_for_template(\renderer_base $output) {
117118
} else if ($course->tabsview == \format_onetopic::TABSVIEW_VERTICALALL) {
118119
$hastopictabs = $format->hastopictabs;
119120
$hassecondrow = false;
121+
$hassubtabs = true;
120122

121123
foreach ($tabslist as $tab) {
122124
if (isset($tab->secondrow) && is_array($tab->secondrow)) {
@@ -177,6 +179,7 @@ public function export_for_template(\renderer_base $output) {
177179
'tabs' => $tabslist,
178180
'activetab' => $activetab,
179181
'hassecondrow' => $hassecondrow,
182+
'hassubtabs' => $hassubtabs,
180183
'secondrow' => $secondtabslist,
181184
'tabsviewclass' => $tabsview,
182185
'hasformatmsgs' => count(\format_onetopic::$formatmsgs) > 0,

templates/courseformat/tabtree.mustache

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -52,9 +52,11 @@
5252
</div>
5353
{{/availablemessage}}
5454
</a>
55-
{{#haschilds}}
56-
{{>format_onetopic/courseformat/tabsubtree}}
57-
{{/haschilds}}
55+
{{#hassubtabs}}
56+
{{#haschilds}}
57+
{{>format_onetopic/courseformat/tabsubtree}}
58+
{{/haschilds}}
59+
{{/hassubtabs}}
5860
</li>
5961
{{/tabs}}
6062
</ul>

0 commit comments

Comments
 (0)