diff options
author | Simon Rettberg | 2017-04-26 15:34:58 +0200 |
---|---|---|
committer | Simon Rettberg | 2017-04-26 15:34:58 +0200 |
commit | 2a368cb3e597e35b467a6aebbaf35d42747681f5 (patch) | |
tree | b62b33d104200009dbd62a8272da76337e1b2054 /modules-available/locations | |
parent | [baseconfig_bwlp] Update translations (diff) | |
download | slx-admin-2a368cb3e597e35b467a6aebbaf35d42747681f5.tar.gz slx-admin-2a368cb3e597e35b467a6aebbaf35d42747681f5.tar.xz slx-admin-2a368cb3e597e35b467a6aebbaf35d42747681f5.zip |
[baseconfig] Display inherited value and source when editing module specific settings
This optionally requires a callback to find the inheritance source in
the module in question. The locations module was updated accordingly.
This implements #3120
Diffstat (limited to 'modules-available/locations')
-rw-r--r-- | modules-available/locations/baseconfig/hook.json | 3 | ||||
-rw-r--r-- | modules-available/locations/inc/location.inc.php | 16 |
2 files changed, 18 insertions, 1 deletions
diff --git a/modules-available/locations/baseconfig/hook.json b/modules-available/locations/baseconfig/hook.json index c295e0f6..b7b3581b 100644 --- a/modules-available/locations/baseconfig/hook.json +++ b/modules-available/locations/baseconfig/hook.json @@ -1,5 +1,6 @@ { "table": "setting_location", "field": "locationid", - "tostring": "Location::getName" + "tostring": "Location::getName", + "getfallback": "Location::getBaseconfigParent" }
\ No newline at end of file diff --git a/modules-available/locations/inc/location.inc.php b/modules-available/locations/inc/location.inc.php index 73080094..9977379f 100644 --- a/modules-available/locations/inc/location.inc.php +++ b/modules-available/locations/inc/location.inc.php @@ -280,6 +280,22 @@ class Location } /** + * @param $locationId + * @return bool|array ('value' => x, 'display' => y), false if no parent or unknown id + */ + public static function getBaseconfigParent($locationId) + { + settype($locationId, 'integer'); + $locations = Location::getLocationsAssoc(); + if (!isset($locations[$locationId])) + return false; + $locationId = (int)$locations[$locationId]['parentlocationid']; + if (!isset($locations[$locationId])) + return false; + return array('value' => $locationId, 'display' => $locations[$locationId]['locationname']); + } + + /** * @return array list of subnets as numeric array */ public static function getSubnets() |