Skip to content

Commit

Permalink
New option: exclude modules
Browse files Browse the repository at this point in the history
  • Loading branch information
medienbaecker committed Nov 23, 2022
1 parent a33358a commit 600eca4
Showing 1 changed file with 19 additions and 5 deletions.
24 changes: 19 additions & 5 deletions lib/sections/modules.php
Original file line number Diff line number Diff line change
Expand Up @@ -10,11 +10,25 @@
$blueprints[] = str_replace('pages/', '', $blueprint);
}
}
$default = array_search('module.' . option('medienbaecker.modules.default', 'text'), $blueprints);
if ($default !== false) {
$module_text = $blueprints[$default];
unset($blueprints[$default]);
array_unshift($blueprints, $module_text);

// Move default module to the top
$defaultModule = array_search('module.' . option('medienbaecker.modules.default', 'text'), $blueprints);
if ($defaultModule !== false) {
$defaultBlueprint = $blueprints[$defaultModule];
unset($blueprints[$defaultModule]);
array_unshift($blueprints, $defaultBlueprint);
}

// Exclude modules
$excludedModules = option('medienbaecker.modules.exclude', []);
if (!empty($excludedModules)) {

foreach($excludedModules as $excludedModule) {
if (in_array('module.' . $excludedModule, $blueprints)) {
$key = array_search('module.' . $excludedModule, $blueprints);
unset($blueprints[$key]);
}
}
}

$base = Section::$types['pages'];
Expand Down

0 comments on commit 600eca4

Please sign in to comment.