Skip to content

Commit 600eca4

Browse files
committed
New option: exclude modules
1 parent a33358a commit 600eca4

File tree

1 file changed

+19
-5
lines changed

1 file changed

+19
-5
lines changed

lib/sections/modules.php

Lines changed: 19 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -10,11 +10,25 @@
1010
$blueprints[] = str_replace('pages/', '', $blueprint);
1111
}
1212
}
13-
$default = array_search('module.' . option('medienbaecker.modules.default', 'text'), $blueprints);
14-
if ($default !== false) {
15-
$module_text = $blueprints[$default];
16-
unset($blueprints[$default]);
17-
array_unshift($blueprints, $module_text);
13+
14+
// Move default module to the top
15+
$defaultModule = array_search('module.' . option('medienbaecker.modules.default', 'text'), $blueprints);
16+
if ($defaultModule !== false) {
17+
$defaultBlueprint = $blueprints[$defaultModule];
18+
unset($blueprints[$defaultModule]);
19+
array_unshift($blueprints, $defaultBlueprint);
20+
}
21+
22+
// Exclude modules
23+
$excludedModules = option('medienbaecker.modules.exclude', []);
24+
if (!empty($excludedModules)) {
25+
26+
foreach($excludedModules as $excludedModule) {
27+
if (in_array('module.' . $excludedModule, $blueprints)) {
28+
$key = array_search('module.' . $excludedModule, $blueprints);
29+
unset($blueprints[$key]);
30+
}
31+
}
1832
}
1933

2034
$base = Section::$types['pages'];

0 commit comments

Comments
 (0)