function _content_type_groups_store_group_data in Content type groups 7.2
Same name and namespace in other branches
- 7 content_type_groups.features.inc \_content_type_groups_store_group_data()
Stores exported content type group data in the database
Parameters
array $data: Information about a single content type from feature export.
array $node_types: Results from node_type_get_types(). Passed through to avoid calling this each time this function is called.
1 call to _content_type_groups_store_group_data()
- content_type_groups_features_rebuild in ./
content_type_groups.features.inc - Implementation of hook_features_rebuild(). [component_hook]
File
- ./
content_type_groups.features.inc, line 140 - Export functionality for the content type groups module.
Code
function _content_type_groups_store_group_data($data, $node_types = NULL) {
if (!$node_types) {
$node_types = _content_type_groups_get_node_types();
}
// Create the group
$group = new ContentTypeGroup($data['type']);
// If the group already exists, clear out the existing content types
if ($group->name) {
$group->content_types = array();
}
// Fill in the stored name and content types
$group->name = $data['name'];
foreach ($data['content_types'] as $content_type => $type_data) {
if (in_array($content_type, $node_types)) {
// Only add existing node types
$group
->addContentType($content_type, $type_data['weight']);
}
}
// Save the group
$group
->save();
}