function spaces_features in Spaces 6.2
Same name and namespace in other branches
- 5.2 spaces.module \spaces_features()
- 5 spaces.module \spaces_features()
- 6.3 spaces.module \spaces_features()
- 6 spaces.module \spaces_features()
- 7.3 spaces.module \spaces_features()
- 7 spaces.module \spaces_features()
Retrieve all available features.
Parameters
$type: Optional type flag by which to filter available features.
$reset: Optional boolean flag for resetting the static cache.
Return value
Keyed array of potential features.
12 calls to spaces_features()
- spaces::testSpaces in tests/
spaces.test - spaces_customize_form in ./
spaces_admin.inc - Feature customization form.
- spaces_features_items in ./
spaces.module - Returns an array of items of a given type that belong to a given feature.
- spaces_features_map in ./
spaces.module - Caches a map of feature component => feature name
- spaces_feature_settings in ./
spaces.module - Retrieve settings provided by a given feature.
1 string reference to 'spaces_features'
- spaces_update_6001 in ./
spaces.install - Update script 6001.
File
- ./
spaces.module, line 978
Code
function spaces_features($type = NULL, $reset = FALSE) {
static $spaces_features;
if (!isset($spaces_features) || $reset) {
$spaces_features = array(
'all' => array(),
'common' => array(),
);
$features = features_get_features();
foreach ($features as $feature) {
if (module_exists($feature->name) && !empty($feature->info['spaces'])) {
if (!empty($feature->info['spaces']['types']) && is_array($feature->info['spaces']['types'])) {
foreach ($feature->info['spaces']['types'] as $t) {
$spaces_features[$t][$feature->name] = $feature;
}
}
else {
$spaces_features['common'][$feature->name] = $feature;
}
$spaces_features['all'][$feature->name] = $feature;
}
}
foreach (array_keys($spaces_features) as $t) {
if ($t != 'all' && $t != 'common') {
$spaces_features[$t] = array_merge($spaces_features[$t], $spaces_features['common']);
}
}
}
if ($type) {
return !empty($spaces_features[$type]) ? $spaces_features[$type] : $spaces_features['common'];
}
return $spaces_features['all'];
}