function spaces_features in Spaces 6
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.2 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.
21 calls to spaces_features()
- spaces::testSpaces in tests/
spaces.test - spaces_content_types in ./
spaces.module - Returns a content type => features map.
- 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
1 string reference to 'spaces_features'
- spaces_update_6001 in ./
spaces.install - Update script 6001.
File
- ./
spaces.module, line 1306
Code
function spaces_features($type = NULL, $reset = FALSE) {
static $spaces_features;
if (!isset($spaces_features) || $reset) {
$spaces_features = array(
'all' => array(),
'common' => array(),
);
foreach (context_enabled_contexts('spaces') as $feature) {
if (!empty($feature->spaces)) {
if (!empty($feature->spaces['types'])) {
foreach ($feature->spaces['types'] as $t) {
$spaces_features[$t][$feature->value] = $feature;
}
}
else {
$spaces_features['common'][$feature->value] = $feature;
}
$spaces_features['all'][$feature->value] = $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'];
}