function spaces_settings in Spaces 6
Same name and namespace in other branches
- 5.2 spaces.module \spaces_settings()
- 5 spaces.module \spaces_settings()
- 6.2 spaces.module \spaces_settings()
Retrieve all available settings.
Parameters
$reset: Optional boolean flag for resetting the static cache.
Return value
Keyed array of potential settings.
5 calls to spaces_settings()
- spaces_features_form_submit in ./
spaces_admin.inc - Submit handler for spaces features form
- spaces_features_form_validate in ./
spaces_admin.inc - Validate handler for spaces features form
- spaces_preset_form_submit in ./
spaces_admin.inc - Submit handler for spaces preset form.
- spaces_save in ./
spaces.module - Saves a space object's feature/setting values.
- _spaces_features_form in ./
spaces_admin.inc - Core form for controlling features / settings
File
- ./
spaces.module, line 1344
Code
function spaces_settings($type = NULL, $reset = FALSE) {
static $spaces_settings;
if (!isset($spaces_settings) || $reset) {
$spaces_settings = array(
'all' => array(),
'common' => array(),
);
foreach (module_implements('spaces_settings') as $module) {
$function = $module . '_spaces_settings';
$settings = $function();
foreach ($settings as $setting) {
if (!empty($setting->types)) {
foreach ($setting->types as $t) {
if (!isset($spaces_settings[$t])) {
$spaces_settings[$t] = array();
}
$spaces_settings[$t][$setting->id] = $setting;
}
}
else {
$spaces_settings['common'][$setting->id] = $setting;
}
$spaces_settings['all'][$setting->id] = $setting;
}
}
foreach (array_keys($spaces_settings) as $t) {
if ($t != 'all' && $t != 'common') {
$spaces_settings[$t] = array_merge($spaces_settings[$t], $spaces_settings['common']);
}
}
}
if ($type) {
return !empty($spaces_settings[$type]) ? $spaces_settings[$type] : $spaces_settings['common'];
}
return $spaces_settings['all'];
}