diff options
Diffstat (limited to 'modules-available/locations/inc/locationhooks.inc.php')
-rw-r--r-- | modules-available/locations/inc/locationhooks.inc.php | 29 |
1 files changed, 29 insertions, 0 deletions
diff --git a/modules-available/locations/inc/locationhooks.inc.php b/modules-available/locations/inc/locationhooks.inc.php new file mode 100644 index 00000000..f6ef02da --- /dev/null +++ b/modules-available/locations/inc/locationhooks.inc.php @@ -0,0 +1,29 @@ +<?php + +class LocationHooks +{ + + /** + * Resolve baseconfig id to locationid -- noop in this case + */ + public static function baseconfigLocationResolver(int $id): int + { + return $id; + } + + /** + * Hook to get inheritance tree for all config vars + * @param int $id Locationid currently being edited + */ + public static function baseconfigInheritance(int $id): array + { + $locs = Location::getLocationsAssoc(); + if ($locs === false || !isset($locs[$id])) + return []; + BaseConfig::prepareWithOverrides([ + 'locationid' => $locs[$id]['parentlocationid'] ?? 0 + ]); + return ConfigHolder::getRecursiveConfig(true); + } + +}
\ No newline at end of file |