function globallink_config_features_rebuild in GlobalLink Connect for Drupal 7.6
Same name and namespace in other branches
- 7.7 globallink.features.inc \globallink_config_features_rebuild()
- 7.5 globallink.features.inc \globallink_config_features_rebuild()
Implementation of hook_features_rebuild(). [component_hook]
1 call to globallink_config_features_rebuild()
- globallink_config_features_revert in ./
globallink.features.inc - Implementation of hook_features_revert(). [component_hook]
File
- ./
globallink.features.inc, line 135 - Provides Features integration for the GlobalLink module to export settings and field configurations.
Code
function globallink_config_features_rebuild($module) {
$items = module_invoke($module, 'globallink_config_features_default_settings');
foreach ($items as $key => $value) {
$pos = strpos($key, '|');
if ($pos) {
$params = explode("|", $key);
$fid = db_query("select fid from {globallink_field_config} where content_type = :content_type AND field_name = :field_name", array(
":content_type" => $params[0],
":field_name" => $params[1],
))
->fetchAll();
if (count($fid) > 0) {
db_update('globallink_field_config')
->fields(array(
'content_type' => $value['content_type'],
'entity_type' => $value['entity_type'],
'bundle' => $value['bundle'],
'field_name' => $value['field_name'],
'field_type' => $value['field_type'],
'field_label' => $value['field_label'],
'field_format' => $value['field_format'],
'translatable' => $value['translatable'],
))
->condition('fid', $fid[0]->fid, '=')
->execute();
}
else {
db_insert('globallink_field_config')
->fields(array(
'content_type' => $value['content_type'],
'entity_type' => $value['entity_type'],
'bundle' => $value['bundle'],
'field_name' => $value['field_name'],
'field_type' => $value['field_type'],
'field_label' => $value['field_label'],
'field_format' => $value['field_format'],
'translatable' => $value['translatable'],
))
->execute();
}
}
else {
$result = db_query("SELECT * FROM {globallink_locale} WHERE locale_code = :code", array(
':code' => $key,
))
->fetchAll();
if (count($result) > 0) {
db_update('globallink_locale')
->fields(array(
'locale_code' => $value['locale_code'],
'locale_desc' => $value['locale_desc'],
'drupal_locale_code' => $value['drupal_locale_code'],
'drupal_locale_desc' => $value['drupal_locale_desc'],
))
->condition('locale_code', $key, '=')
->execute();
}
else {
variable_set($key, $value);
}
}
}
}