function eck_bundle_features_rebuild in Entity Construction Kit (ECK) 7.2
Same name and namespace in other branches
- 7.3 eck.features.inc \eck_bundle_features_rebuild()
Implements hook_features_rebuild().
Rebuilds eck entities from code defaults.
1 call to eck_bundle_features_rebuild()
- eck_bundle_features_revert in ./
eck.features.inc - Implements hook_features_revert().
File
- ./
eck.features.inc, line 231 - Integration with the Features module.
Code
function eck_bundle_features_rebuild($module) {
if ($default_types = features_get_default('eck_bundle', $module)) {
// Reset the bundles cache.
Bundle::loadAll(TRUE);
foreach ($default_types as $bundle_machine_name => $bundle_info) {
$bundle = Bundle::loadByMachineName($bundle_machine_name);
if (empty($bundle->id)) {
$bundle = new Bundle();
}
foreach ($bundle_info as $key => $value) {
$bundle->{$key} = $value;
}
$bundle
->save();
}
}
}