function globallink_insert_all_fields in GlobalLink Connect for Drupal 7.5
Same name and namespace in other branches
- 7.7 globallink.module \globallink_insert_all_fields()
- 7.6 globallink.module \globallink_insert_all_fields()
Adds all fields of content type to field config.
Parameters
string $content_type: The node content type.
1 call to globallink_insert_all_fields()
- globallink_node_type_update in ./
globallink.module - Implements hook_node_type_update().
File
- ./
globallink.module, line 678 - GlobalLink translation module.
Code
function globallink_insert_all_fields($content_type) {
module_load_include('inc', 'globallink', 'globallink_field_configuration');
$p_arr = globallink_get_pending_fields($content_type);
$f_keys = array_keys($p_arr);
foreach ($f_keys as $f_key) {
if ($f_key == '[all]') {
continue;
}
if ($f_key != 'title' && $f_key != 'metatags') {
$field = field_info_field($f_key);
switch ($field['type']) {
case 'list_boolean':
case 'image':
case 'file':
case 'taxonomy_term_reference':
case 'field_collection':
break;
default:
db_insert('globallink_field_config')
->fields(array(
'content_type' => $content_type,
'entity_type' => 'node',
'bundle' => $content_type,
'field_name' => $f_key,
'field_type' => $field['type'],
'field_label' => $p_arr[$f_key],
'translatable' => 1,
))
->execute();
}
}
else {
db_insert('globallink_field_config')
->fields(array(
'content_type' => $content_type,
'entity_type' => 'node',
'bundle' => $content_type,
'field_name' => $f_key,
'field_type' => 'text',
'field_label' => $p_arr[$f_key],
'translatable' => 1,
))
->execute();
}
}
if (module_exists('field_collection')) {
globallink_insert_fc_fields($content_type);
}
}