function spaces_feature_settings in Spaces 6.2
Retrieve settings provided by a given feature.
Parameters
$feature: Optional feature name whose settings should be returned.
$reset: Boolean flag to reset static cache.
Return value
An array of instantiated setting classes.
4 calls to spaces_feature_settings()
- spaces_customize_form in ./
spaces_admin.inc - Feature customization form.
- spaces_customize_form_submit in ./
spaces_admin.inc - Submit handler for feature customization form.
- spaces_customize_form_validate in ./
spaces_admin.inc - Validate handler for spaces features form
- spaces_save in ./
spaces.module - Saves a space object's feature/setting values.
File
- ./
spaces.module, line 1019
Code
function spaces_feature_settings($feature = NULL, $reset = FALSE) {
static $feature_settings;
if (!isset($feature_settings) || $reset) {
$feature_settings = array();
// Exclude feature-specific settings here
$features = spaces_features();
foreach (module_implements('spaces_settings') as $module) {
if (isset($features[$module])) {
$settings = module_invoke($module, 'spaces_settings');
foreach ($settings as $id => $info) {
// Load any setting includes before instantiating its class.
if (is_array($info)) {
if (isset($info['file']) && is_file($info['file'])) {
require_once $info['file'];
}
if (isset($info['class']) && class_exists($info['class'])) {
$class = $info['class'];
$setting = new $class();
}
}
else {
if (is_string($info) && class_exists($info)) {
$setting = new $info();
}
else {
if (is_object($info)) {
$setting = $info;
}
}
}
$feature_settings[$module][$id] = $setting;
}
}
}
}
if ($feature) {
return isset($feature_settings[$feature]) ? $feature_settings[$feature] : array();
}
return $feature_settings;
}