You are here

function eck_bundle_features_rebuild in Entity Construction Kit (ECK) 7.3

Same name and namespace in other branches
  1. 7.2 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 224
Integration with the Features module.

Code

function eck_bundle_features_rebuild($module) {
  if ($default_types = features_get_default('eck_bundle', $module)) {
    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();
    }
    Bundle::loadAll(NULL, TRUE);
    drupal_get_schema(NULL, TRUE);
    entity_info_cache_clear();
    variable_set('menu_rebuild_needed', TRUE);
  }
}