function spaces_features in Spaces 5.2
Same name and namespace in other branches
- 5 spaces.module \spaces_features()
- 6.3 spaces.module \spaces_features()
- 6 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.
17 calls to spaces_features()
- spaces::testSpaces in tests/
spaces.test - spaces_content_types in ./
spaces.module - Returns a content type => features map.
- spaces_customize in ./
spaces_admin.inc - Customization page callback.
- spaces_features_menu in ./
spaces.module - Returns a links array in the theme_links() format of the current space's menu items for features accessible to the current user. Each item has a keyed array of children items if applicable.
- spaces_node_links in ./
spaces.module - Generates a set of links for node types associated with the current active contexts.
File
- ./
spaces.module, line 941
Code
function spaces_features($type = NULL, $reset = FALSE) {
static $spaces_features;
if (!isset($spaces_features) || $reset) {
$spaces_features = array();
foreach (context_ui_defaults('spaces') as $feature) {
if ($feature->spaces) {
// If type is specified, perform additional checks
if ($type) {
if (isset($feature->spaces['types']) && in_array($type, $feature->spaces['types'])) {
$spaces_features[$feature->value] = $feature;
}
else {
if (!isset($feature->spaces['types']) || !$feature->spaces['types']) {
$spaces_features[$feature->value] = $feature;
}
}
}
else {
$spaces_features[$feature->value] = $feature;
}
}
}
}
return $spaces_features;
}