You are here

function profile_field_features_rebuild in Features 6

Implementation of hook_features_rebuild().

1 call to profile_field_features_rebuild()
profile_field_features_revert in includes/features.profile.inc
Implementation of hook_features_revert().

File

includes/features.profile.inc, line 71

Code

function profile_field_features_rebuild($module) {
  if ($defaults = features_get_default('profile_field', $module)) {
    foreach ($defaults as $field) {

      // If the field doesn't exist in the DB at the moment then insert it.
      if (db_result(db_query("SELECT COUNT(*) FROM {profile_fields} WHERE name = '%s'", $field['name'])) == 0) {
        drupal_write_record('profile_fields', $field);
      }
      else {
        drupal_write_record('profile_fields', $field, 'name');
      }
    }
  }
}